I have an array of 200 items. I would like to output the array but group the items with a common value. Similar to SQL\'s GROUP BY method. This should be relatively easy to
$aA = array_count_values(array(1,2,3,4,5,1,2,3,4,5,6,1,1,1,2,2)); $aB = array(); foreach($aA as $index=>$aux){ array_push($aB,$index); } print_r($aB);
Result:
Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 )