Possible Duplicate:
Count number of values in array with a given value
Let’s say I’ve an array fruits:
$fruits = array("apple", "apple", "apple", "banana", "banana", "strawberry");
I want to transform this array into an array count:
$count = array("apple" => 3, "banana" => 2, "strawberry" => 1);
What would be the easiest way possible to archieve this?
Hy there,
You can use array_count_values