each() function returns the key-value pair at the current pointer position and moves the pointer to the next element. : each « Data Structure « PHP






each() function returns the key-value pair at the current pointer position and moves the pointer to the next element.

 
//The syntax is: array each (array array)

<?
    $spices = array("A", "B", "C", "D", "E");
    reset($spices);
    $a_spice = each($spices);
    print_r($a_spice[1]);
    print_r($a_spice["value"]);
?>
  
  








Related examples in the same category

1.Using each() function in conjunction with list()