Home >Backend Development >PHP Tutorial >PHP linear table push and pop example analysis, PHP linear table example analysis_PHP tutorial

PHP linear table push and pop example analysis, PHP linear table example analysis_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 09:51:00889browse

Example analysis of pushing and popping PHP linear tables into the stack, PHP linear table case analysis

The examples in this article describe the usage of PHP linear tables being pushed into and popped out of the stack. Share it with everyone for your reference. The details are as follows:

<&#63;php 
$stack = array("Simon", "Elaine"); //定义数组 
array_push($stack, "Helen", "Peter"); //入栈 
print_r($stack); 
&#63;>
<&#63;php 
$stack = array("Simon", "Elaine"); //定义数组 
array_unshift ($stack, "Helen", "Peter"); //入栈 
print_r($stack); 
&#63;>
<&#63;php 
$stack = array("Simon", "Elaine", "Helen", "Peter"); 
echo array_pop($stack)."/n"; //出栈 
print_r($stack); 
&#63;>
<&#63;php 
$stack = array("Simon", "Elaine", "Helen", "Peter"); 
echo array_shift($stack)."/n"; //出栈 
print_r($stack); 
&#63;>

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1015427.htmlTechArticleExample analysis of pushing and popping php linear tables into the stack, php linear table example analysis This article tells the example of php linear tables Pushing and popping usage. Share it with everyone for your reference. The details are as follows: p...
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