I have an array like below. How do I get it to return the max name?
$array = array('Apple','Apple','Grape','Orange','Orange','Lemon','Pear','Apple');
In the above example how do I get it to return 'Apple'
I can get the maximum count which is 4 with:
$answer = max(array_count_values($array));
But I need the name too.
Any help would be greatly appreciated. Thanks in advance