Adds elements to the beginning of an array.
With array_unshift(), one or more elements can be added to the beginning of an array. This function is very similar to array_push(), but it pushes elements onto the beginning rather than the end of the array. The function returns the number of elements that were added to the array.
<?php
$array1 = array(4, 5, 6);
array_unshift($array1, 1, 2, 3);
foreach ($array1 as $element) {
print "$element ";
}
?>
1 2 3 4 5 6
The new elements in the array will be ordered the same way as the parameters.