How to get the key of the highest value in an associative (key value) array with PHP

1 Answer

0 votes
$arr = array('a' => 888,
             'b' => 731,
             'c' => 981,
             'd' => 982,
             'e' => 523,
             'f' => 672);

arsort($arr);

echo key($arr);



/*
run:

d
 
*/

 



answered Mar 2, 2019 by avibootz
...