Home >php教程 >php手册 >PHP5.5 SplStack

PHP5.5 SplStack

WBOY
WBOYOriginal
2016-06-06 19:37:571471browse

无详细内容 无 ?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($stack as

<?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";
}

?>
PHP5.5 SplStack
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn