array_shift() function operates much like array_pop() : array_shift « Data Structure « PHP






array_shift() function operates much like array_pop()

 
//array_shift() function removes one element from the left side of the array. 
//All remaining array elements are shifted one unit toward the left side of the array. 
//array_shift() has the same syntax as array_pop():

<?
    $languages = array("Spanish", "English", "French", "Russian");
    $a_language = array_shift($languages); 
    print_r($a_language);
?>
  
  








Related examples in the same category

1.Removing the First Element of an Array with array_shift()
2.Removing the First or Last Element from an Array
3.array_shift( ) function returns the value from the front of the array while also removing it from the array.