array_shift

(PHP 4 >= 4.0b1)

array_shift --  Pop an element off the beginning of array

Description

mixed array_shift (array array)

array_shift() shifts the first value of the array off and returns it, shortening the array by one element and moving everything down. If array is empty (or is not an array), NULL will be returned.

Example 1. array_shift() example


$args = array ("-v", "-f");
$opt = array_shift ($args);
      

This would result in $args having one element "-f" left, and $opt being "-v".

See also array_unshift(), array_push(), and array_pop().