[Solved] Total number members in a group [closed]


Execute below code that will help you.

$arr_ids    =   array(array('id'=>10,'group'=> '1'),
                      array('id'=>20,'group'=> '1'),
                      array('id'=>30,'group'=> '2'),
                      array('id'=>40,'group'=> '3'),
                      array('id'=>50,'group'=> '3'),
                      array('id'=>60,'group'=> '3'),
                      array('id'=>70,'group'=> '4'),
                );

foreach($arr_ids as $ids)
{
    $arr_groups[]   = $ids['group'];
}   
$count_arr  =   array_count_values($arr_groups);
print"<pre>"; 
print_r($arr_groups);
print_r($count_arr);

foreach($count_arr as $group=>$count)
{
    echo "Group ".$group." = ".$count."<br>";
}
print"</pre>";

1

solved Total number members in a group [closed]