array_unshift() function shifts the array to the right. : array_unshift « Data Structure « PHP






array_unshift() function shifts the array to the right.

 
//Its syntax is: int array_unshift(array array, mixed var1 [, mixed var2. . .])

//You can append one or several values simultaneously.

<?
    $languages = array ("French", "Italian");
    array_unshift ($languages, "Russian", "Chinese");
    print_r($languages);
?>
  
  








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 pushes value onto the start of the array