array_shift
Shift an element off the beginning of array
Description
mixed array_shift(array &$array
)
Note: This function will
reset the array pointer of the input array after
use.
Parameters
-
array
-
The input array.
Return Values
Returns the shifted value, or null
if array
is
empty or is not an array.
Examples
Example #1 array_shift example
<?php
$stack = array("orange", "banana", "apple", "raspberry");
$fruit = array_shift($stack);
print_r($stack);
?>
The above example will output:
Array
(
[0] => banana
[1] => apple
[2] => raspberry
)
and orange
will be assigned to
$fruit.
See Also
- array_unshift
- array_push
- array_pop