I have an array:
array( 4 => \'apple\', 7 => \'orange\', 13 => \'plum\' )
I would like to get the first element of this array. Expect
$array=array( 4 => 'apple', 7 => 'orange', 13 => 'plum' ); $firstValue = each($array)[1];
This is much more efficient than array_values() because the each() function does not copy the entire array.
array_values()
each()
For more info see http://www.php.net/manual/en/function.each.php