PHP array_shift() Function
The array_shift() function is used to remove 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.
Parameter | Description |
---|---|
array | Required. Specifies an array |
Syntax
array_shift(array)
Example
$array = array(0=>"Cooper",1=>5,2=>"Samuel");
echo array_shift($array);
print_r($array);
Leave a Reply