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);
More Related Contents:
- Sort an Array by keys based on another Array?
- PHP Sort Array By SubArray Value
- Sorting an associative array in PHP [duplicate]
- glob() – sort array of files by last modified datetime stamp
- Sorting a php array of arrays by custom order
- Find a matching or closest value in an array
- PHP sort array by two field values [duplicate]
- Sorting a multidimensional array in PHP? [duplicate]
- Preserve key order (stable sort) when sorting with PHP’s uasort
- How do I sort a multidimensional array by one of the fields of the inner array in PHP? [duplicate]
- Sort array of objects by one property
- PHP array multiple sort – by value then by key?
- Group array by subarray values
- Sort an array by a child array’s value in PHP
- scandir() to sort by date modified
- PHP order array by date? [duplicate]
- PHP Sort array by field? [duplicate]
- Using usort in php with a class private function
- Sort Object in PHP
- How to GROUP BY and SUM PHP Array? [duplicate]
- Sort a flat, associative array by numeric values, then by non-numeric keys
- How can I sort an array of UTF-8 strings in PHP?
- Sort array of objects by date field
- Custom key-sort a flat associative based on another array
- Isolate comma-separated values, remove duplicates and empty values, then sort
- Sort array by value alphabetically php
- how to sort a multidemensional array by an inner key
- Sort array by numeric keys
- Sort a multidimensional array descending by subarray count and preserve first level keys
- PHP-Sort array based on another array?