Using the $arr variable for your array, you can do this:
$out = array(); foreach ($arr as $key => $value){ foreach ($value as $key2 => $value2){ $index = $key2.'-'.$value2; if (array_key_exists($index, $out)){ $out[$index]++; } else { $out[$index] = 1; } } } var_dump($out);
Output:
Array ( [07/11-134] => 2 [07/11-145] => 2 [07/12-134] => 1 [07/12-99] => 1 )
Here's another version that produces it as a multidimensional array:
$out = array(); foreach ($arr as $key => $value){ foreach ($value as $key2 => $value2){ if (array_key_exists($key2, $out) && array_key_exists($value2, $out[$key2])){ $out[$key2][$value2]++; } else { $out[$key2][$value2] = 1; } } }
Output:
Array ( [07/11] => Array ( [134] => 2 [145] => 2 ) [07/12] => Array ( [134] => 1 [99] => 1 ) )
source share