Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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
#)
 
PREVIOUS NEXT
Tagged: #php #group #array #count
ADD COMMENT
Topic
Name
3+6 =