array_unshift( ) function pushes value onto the start of the array : array_unshift « Data Structure « PHP






array_unshift( ) function pushes value onto the start of the array

 
int array_unshift ( array &arr, mixed var [, mixed ...] )
<?
    $firstname = "Johnny";
    $names = array("Timmy", "Bobby", "Sam", "Tammy", "Joe");
    array_unshift($names, $firstname);
?>
  
  








Related examples in the same category

1.Adding an Element to the Beginning of an Array
2.Adding an Element to the Beginning of an Array: int array_unshift(array $arr, mixed $val[, mixed $val2[, ...]])
3.array_unshift() function shifts the array to the right.