PHP Get Highest Value from Array
Don't sort the array to get the largest value.
Get the max value:
$value = max($array);
Get the corresponding key:
$key = array_search($value, $array);
If you just want the largest value in the array use the max function. This will return the largest value, although not the corresponding key. It does not change the original array.
If you care about the the key you could then do
$key = array_search(max($array), $array)
(Edited to include @binaryLV's suggestion)