$array = array(1, 2, 3, 3, 3, 4, 4, 5, 6, 6, 6, 6, 7); print_r(array_count_values($array)); Result: Array ( [1] => 1 ,[2] => 1 , [3] => 3, [4] => 2,[5] =>1, [6] => 4, [7] => 1 )