Array_unshitf () inserts one or more units at the beginning of the array [function] This function inserts incoming units into the beginning of the specified array. Note that the units are inserted as a whole, therefore, the input unit changes all the numeric key names in the same order to count again from scratch... syntaxHighlighter. all ();
Array_unshitf () inserts one or more units at the beginning of the array.
[Function]
This function inserts the incoming unit into the beginning of the specified array.
Note that the unit is inserted as a whole, so the incoming unit will be in the same order.
All numeric keys will be changed to count again from scratch, and all text keys will remain unchanged.
Returns the number of new elements in the array.
Scope of use]
Php4, php5.
[Use]
Int array_unshift (array & array, mixed var [, mixed...])
& Array/required/the original array to be inserted
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"
}
*/
Taken from zuodefeng's note