Remove the first element (red) from an array, and return the value of the removed element:
The array_shift() function removes the first element from an array, and returns the value of the removed element.
Note: If the keys are numeric, all elements will get new keys, starting from 0 and increases by 1 (See example below).
Parameter | Description |
---|---|
array | Required. Specifies an array |
Return Value: | Returns the value of the removed element from an array, or NULL if the array is empty |
---|---|
PHP Version: | 4+ |
Using numeric keys: