php max function to get name of highest value?
I have a multi array and I am using the max function to return the highest value, however I'd like it to return the name? How can I do that?
$total = array($total_one => 'Total One', $total_two => 'Total Two');
echo ma开发者_Python百科x(array_keys($total));
Thanks!!
First off, I think you have your keys and values reversed in your array. But nonetheless, you can do something like this:
echo $total[max(array_keys($total))]
精彩评论