Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // array
- $array = (new DataTypeArray())->push('The')->push('quick')->push('brown')->push('fox');
- foreach($array as $word) print $word." "; // The quick brown fox
- print $array->pop()."\n"; // fox
- print $array->pop()."\n"; // brown
- print $array->pop()."\n"; // quick
- print $array->pop()."\n"; // The
- // stack
- $stack = (new Stack())->push('The')->push('quick')->push('brown')->push('fox');
- foreach($stack as $word) print $word." "; // fox brown quick The
- print $stack->pop()."\n"; // fox
- print $stack->pop()."\n"; // brown
- print $stack->pop()."\n"; // quick
- print $stack->pop()."\n"; // The
- // queue
- $queue = (new Queue())->push('The')->push('quick')->push('brown')->push('fox');
- foreach($queue as $word) print $word." "; // The quick brown fox
- print "\n";
- print $queue->pop()."\n"; // The
- print $queue->pop()."\n"; // quick
- print $queue->pop()."\n"; // brown
- print $queue->pop()."\n"; // fox
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement