php线性表的入栈与出栈实例分析

<?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); ?>

<?php $stack = array("Simon", "Elaine", "Helen", "Peter"); echo array_pop($stack)."/n"; //出栈 print_r($stack); ?>

<?php $stack = array("Simon", "Elaine", "Helen", "Peter"); echo array_shift($stack)."/n"; //出栈 print_r($stack); ?>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/3a879a6c7144d4d87c26ec67824d2fb6.html