If you have an array and want to find the maximum value, use the max() function. You can pass several variables to max or an array.
Code:
echo max(1, 3, 5, 6, 7); // Will echo 7
echo max(array(2, 4, 8)); // Will Echo 8
Key/Index of Max Value
But what if you need to find the key/Index of the max value? Using max will output incorrect results:
Code:
echo max(array("Jan"=>7, May"=>4, "April"=>5));
Which echos "7",
...