php函数,入栈与出栈
2017-07-20 本文已影响0人
凌乱秋天
<?php
$stack=array("Simon","Elaine");//定义数组
array_push($stack,"Helen","Peter");//入栈
print_r($stack);
<?php
$stack=array("Simon","Elaine");//定义数组
array_unshift($stack,"Helen","Peter");//入栈
print_r($stack);
?>
$stack=array("Simon","Elaine","Helen","Peter");
echo array_pop($stack)."<br>";//出栈
print_r($stack);
?>
<?php
$stack=array("Simon","Elaine","Helen","Peter");
echoarray_shift($stack)."<br>";//出栈
print_r($stack);
?>