Reputation: 1
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 max(array_keys($total));
Thanks!!
Upvotes: 0
Views: 260
Reputation: 19635
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))]
Upvotes: 2