Php-Arrays function-array_unshift-insert one or more units at the beginning of the array. 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, input array_unshitf () to insert 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
Http://www.bkjia.com/PHPjc/478193.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/478193.htmlTechArticlearray_unshitf () inserts one or more units at the beginning of an array [function] This function inserts incoming units into the beginning of a specified array. Note that units are inserted as a whole, so Upload...