1. Use arrays to implement stacks
Stack is an implementation form of data structure, and a "first in, last out" data structure is used for data storage. In php, treat the array as a stack and use the two functions array_push() and array_pop() to complete the push and pop operations of data.
-->array_push(): Push one or more units to the end of the array (push onto the stack), and then return the length of the new group.
-->array_pop(): Pop the last unit of the array into the array (pop off the stack)
2. Use arrays to implement queues
Queue is an implementation form of data structure. Data storage adopts "first in, first out" data structure. In PHP, you can use the array_push() and array_shift() functions to complete the data queue operation by treating the array as a stack.
-->array_shift(): Move the element at the beginning of the array out of the array, and then return the value of the deleted element.
? ? ? -->array_shift(): Insert one or more cells at the beginning of the array