Arrays

Removes an element from the beginning of an array

array_shift(array &$array): mixed

Accepts only one parameter, the array by reference

Note: This function will reset() the array pointer of the input array after use.

Returns the shifted element.

Returns null if the array is empty

        
    

Prepend one or more elements at the beginning of a PHP array.

 

array_unshift(array &$array, mixed ...$values): int

array_unshift() accepts at least 2 params (since PHP version 7.3 the function can be called with only one parameter)

The first parameter is the array called by reference, new values will be added.  The next parameters are the values to added to the array.

Returns the new number of elements in the array.