PHP -Gruppenarray nach Wert und Anzahl

$colors=array("red","red","red","blue","green");
$colorsCount=array_count_values($colors);
print_r($colorsCount);
#Array
#(
#    [red] => 3
#    [blue] => 1
#    [green] => 1
#)
Friendly Hawk