/ Published in: PHP
A rudimentary stack class.
Expand |
Embed | Plain Text
class Stack { public function add($item) { $this->stack[] = $item; return $this; } { } { } public function contains($item, $strict=false) { } public function __get($fn) { return $this->$fn(); } } // EXAMPLE $stack = new Stack(); $stack->add('apples') ->add('oranges') ->add('pears') ->add('strawberries'); while ($x = $stack->next) { } echo '</pre>';
You need to login to post a comment.
