array_unshitf() inserts one or more cells at the beginning of the array
【Function】
This function inserts the passed in unit to the beginning of the specified array
Note that the cells are inserted as a whole, so the incoming cells will maintain the same order
All numerical key names will be modified to count again from zero, and all text key names will remain unchanged
Finally, return the new number of cells in the array
【Scope of use】
php4, php5.
【Use】
int array_unshift( array &array,mixed var[,mixed...] )
& Array/Necessary/The original array of the operation of the operation
var/required/value to be added
【Example】
[php]
$array=array("orange","banana");
var_dump(array_unshift($array,'apple','raspberry'));
var_dump($array);
/*
int(4)
array(4) {
[0]=>
string(5) "apple"
[1]=>
string(9) "raspberry"
[2]=>
string(6) "orange"
[3]=>
string(6) "banana"
}
*/
Excerpted from zuodefeng’s notes