Previous | Home | Next |
array_unshift()
The array_unshift() function inserts new elements to an array. The new array values will be inserted in the beginning of the array.
Syntax:array_unshift(array,value1,value2,value3...)
In above syntax, "array" specifying an array, "value1" specifies a value to insert, "value2" specifies a value to insert and "value3" specifies a value to insert.
Example:
<?php $a=array("a"=>"Apple","b"=>"Mango"); array_unshift($a,"Orange"); print_r($a); ?>
Output:
Previous | Home | Next |