1. [代码] [PHP]代码 ?php$stack = new SplStack();// LIFOecho "Stack PUSH\n";$stack[] = 'A';$stack-push('B');$stack-push('C');$stack[] = 'D';$stack[] = 'E';foreach($stack as $val) {echo $val. "\n";}$stack-pop();echo "Stack POP\n";foreach(
1. [代码][PHP]代码
<?php $stack = new SplStack(); // LIFO echo "Stack PUSH\n"; $stack[] = 'A'; $stack->push('B'); $stack->push('C'); $stack[] = 'D'; $stack[] = 'E'; foreach($stack as $val) { echo $val. "\n"; } $stack->pop(); echo "Stack POP\n"; foreach($stack as $val) { echo $val. "\n"; } ?>