美文网首页
php函数,入栈与出栈

php函数,入栈与出栈

作者: 凌乱秋天 | 来源:发表于2017-07-20 21:12 被阅读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);

    ?>

    <?php

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

    ?>

    相关文章

      网友评论

          本文标题:php函数,入栈与出栈

          本文链接:https://www.haomeiwen.com/subject/zreihxtx.html