In PHP, an array is treated as a stack, which is mainly accomplished by using the two system functions array_push() and array_pop(). Pushing onto the stack mainly uses the array_push() function to add one or more elements to the end of the array of the first parameter, and then returns the length of the new array. The example is as follows:
In PHP, when treating an array as a queue, array_push is mainly used () and array_shift() implementation.
Copy the code The code is as follows:
$zhan=array("WEB");//Declare an array as a queue
array_push($zhan,"PHP");//Put Push the string into the stack (array)
array_push($zhan,"WWW.CHHUA.COM");//Push another element
print_r($zhan);//Print the contents of the array
?>
Copy the code The code is as follows:
$zhan =array("WEB","www.chhua.com","WEB Development Notes","PHP","Website Construction");//Declare an array as a stack
array_shift($zhan);//Change the string Dequeuing (array)
print_r($zhan);//Print array content Array([0] => WEB[1] => www.chhua.com[2] => WEB development notes[3] => PHP)
?>
The above introduces the vb.net array. PHP uses arrays to implement queues, including the content of vb.net arrays. I hope it will be helpful to friends who are interested in PHP tutorials.