Little PHP help

Little PHP help
0

#1

I have two arrays

$names = array('Martin','Hardi','Juhan','Tiina','Sirje','Kaie');
$howfarthrow = array(33, 32, 27, 11, 15, 28);

I need to get the name who threw the ball farther away. In my exercise it says i need to use array_keys.

Thanks!


#2

One possible solution could be :

$c = array_combine($names, $howfarthrow);
arsort($c);
$farthest = array_keys($c)[0];
echo $farthest; # echoes "Martin"