This is the function:
function mostFrequent($x) {
$counted = array_count_values($x);
arsort($counted);
return(key($counted));
}
This is the call in the
tag:
<?php
$x=mostFrequent(array('cheese','wine','cheese','bread','cheese','bread'));
echo "$x";
?>
This should work right? Also, how do I avoid having to use the temp $x for the echo and just echo the result of the function call directly?