array_shift() shifts the first value of the array off and returns it, shortening the array by one element and moving everything down. If array is empty (or is not an array), NULL will be returned.
Example 1. array_shift() example
This would result in $stack having 3 elements left:
|
See also array_unshift(), array_push(), and array_pop().