开发者

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))]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜