$input = array(1,1,2,3,2,1,1);
$c = array_count_values($input);
$val = array_search(max($c), $c)
$count =
This returns 1 as expected (most common). How would I find out how many times it occurs in the array? There are many similar questions, but none of them were interested in finding the count.
echo $val. "ccours". $count . "times";
Are you sure you’re interpreting the result correctly? Because the function should do exactly, what you need. From the manual:
The result should then be: