array_shift( ) function returns the value from the front of the array while also removing it from the array. : array_shift « Data Structure « PHP






array_shift( ) function returns the value from the front of the array while also removing it from the array.

 
<?
    $names = array("Johnny", "Timmy", "Bobby", "Sam", "Tammy", "Joe");
    $firstname = array_shift($names); // "Johnny"
    var_dump($names);
?>
  
  








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 operates much like array_pop()