Count duplicate values in multidimensional array

后端 未结 2 1692
别那么骄傲
别那么骄傲 2021-01-25 05:10

I need to count the same values in multidimensional array and remove the duplicates.

My array:

$r = [
    [\'a\',\'b\'],
    [\'a\',\'b\'],
    [\'c\',\'         


        
2条回答
  •  执念已碎
    2021-01-25 05:43

    foreach ( $result1 as $key ):
        $o[implode(', ', $key)][] = null;
         foreach ($o as $key1) {
            $g[implode(', ', $key)] = count($key1);
        }
    endforeach;
    print_r($g);
    

提交回复
热议问题