Try this code for find first element of array.
$array = array( 4 => 'apple', 7 => 'orange', 13 => 'mango' ); echo $array[key($array)];
// key($array) -> will return the first key (which is 4 in this example)
We can get the first element of an array by the function current(); <?php $arr = array('name'=>'angel','age'=>'23','city'=>'delhi','profession'=>'php developer'); $firstvalue = current($arr); echo"$firstvalue"; ?>
OUTPUT : angel