array_shift() removes a cell at the beginning of the array
【Function】
This function will pop up and return the first cell of the array, and then reduce the length of the array by one
All numeric key names will be changed to count from zero
If array is empty or not an array, null will be returned
【Scope of use】
php4, php5.
【Use】
mixed array_shift( array &array )
array/required/upcoming function processing array
【Example】
[php]
$array = array('orange','banana','apple');
var_dump($array);
var_dump(array_shift($array));
var_dump($array);
/*
array(3) {
[0]=>
string(6) "orange"
[1]=>
string(6) "banana"
[2]=>
string(5) "apple"
}
string(6) "orange"
array(2) {
[0]=>
string(6) "banana"
[1]=>
string(5) "apple"
}
*/
Excerpted from zuodefeng’s notes