TStack implements a stack. The typical stack operations are implemented, which include {@link push()}, {@link pop()} and {@link peek()}. In addition, {@link contains()} can be used to check if an item is contained in the stack. To obtain the number of the items in the stack, check the {@link getCount Count} property. Items in the stack may be traversed using foreach as follows, foreach($stack as $item) ...
Since: 3.0
Author: Qiang Xue (qiang.xue@gmail.com)
Inheritance: extends Prado\TComponent, implements IteratorAggregate, implements Countable
Esempio n. 1
0
 public function testGetCount()
 {
     $stack = new TStack();
     self::assertEquals(0, $stack->getCount());
     $stack = new TStack(array(1, 2, 3));
     self::assertEquals(3, $stack->getCount());
 }