php group array by value and count code example
Example: php group array by value and count
$colors=array("red","red","red","blue","green");
$colorsCount=array_count_values($colors);
print_r($colorsCount);
#Array
#(
# [red] => 3
# [blue] => 1
# [green] => 1
#)