Counting distinct values in a multidimensional array

kxqlyyzbnp

New Member
I have an array that looks like the one below. I'm trying to group and count them, but haven't been able to get it to work. The original $result array looks like this:\[code\]Array( [sku] => Array ( [0] => 344 [1] => 344 [2] => 164 ) [cpk] => Array ( [0] => d456 [1] => d456 ))\[/code\]I'm trying to take this and create a new array:\[code\]$item[sku][344] = 2;$item[sku][164] = 1;$item[cpk][d456] = 1;\[/code\]I've gone through various iterations of in_array statements inside for loops, but still haven't been able to get it working. Can anyone help?
 
Back
Top