array_unshift() prepends passed elements to the front of the array. The array_unshift() function, accepts an array and any number of additional values. It will add the value arguments to the start of the given array.
<?php $alpha = array("a", "b", "c"); $final = array_unshift($alpha, "d","e"); print "There are $total elements in \$alpha<p>"; foreach ( $alpha as $val ) { print "$val<br/>"; } print "</p>"; ?>
The output is an array containing d,e,a,b,c respectively positioned.
array_unshift() returns the new size of the array it transforms.