Hi,
I'm trying to count the duplicate entries in a form and thought I'd found the answer in the forum, it appears I should be using array_count_values.
However when I tried this I got a result that confused me.
My code ($posnn are the form values and contain soccer team names)
$array = array ("$pos01","$pos02","$pos03","$pos04","$pos05","$pos06","$pos07","$pos08","$pos09","$pos10","$pos11","$pos12","$pos13","$pos14","$pos15","$pos16","$pos17","$pos18","$pos19","$pos20");
array_count_values($array);
print_r($array);
the result I get is is :
Array ( [0] => Man Utd [1] => Man Utd [2] => Arsenal [3] => Chelsea [4] => Liverpool [5] => Newcastle [6] => Newcastle [7] => Newcastle [8] => Liverpool [9] => Liverpool [10] => Liverpool [11] => Everton [12] => Liverpool [13] => Blackburn [14] => Tottenham [15] => Tottenham [16] => Tottenham [17] => Leicester [18] => Tottenham [19] => Tottenham )
So I thought I'd copy the example from the manual and see what that did :
$array = array (1, "hello", 1, "world", "hello");
print_r(array_count_values ($array));
this result was:
Array ( [1] => 2 [hello] => 2 [world] => 1 )
and this is what I'd thought I'd get with my code.
Am I missing something obvious ?
Thanks