PHP array_shift() Function

PHP array_shift() Function

The array_shift() in PHP shifts the first value of the array off. This function returns the same value after shortening the array by one element and moving everything.

Syntax

Parameter

array(required)– This parameter represents the input array

Return

This function returns the shifted value or returns NULL if the specified array is empty or is not an array.

Example 1

Output

Example 2

Output

Example 3

Output

Example 4

Output