I was wondering how I would go about displaying the most common values in an array, so far my script gives the single most common value but what if I wanted the 5 most common?
function array_most_common($array) {
$counted = array_count_values($array);
arsort($counted);
return(key($counted));
}
echo array_most_common($array);
Many thanks.