Questions
Tags
From an array that looks something like the following, how can I get the index of the highest value in the array. For the array below, the desired result would be '11'.
Array ( [11] => 14 [10] => 9 [12] => 7 [13] => 7 [14] => 4 [15] => 6 )
This question is related to php arrays
php
arrays
My solution is:
$maxs = array_keys($array, max($array))
Note: this way you can retrieve every key related to a given max value.
If you are interested only in one key among all simply use $maxs[0]