二维数组去重方法

技术博客 (137) 2023-12-31 18:01:01
 //二维数组去重
    function moreArrayUnique($arr=array()){
        foreach($arr[0] as $k => $v){
            $arr_inner_key[]= $k;
        }
        foreach ($arr as $k => $v){
            $v =join(",",$v);
            $temp[$k] =$v;
        }
        $temp =array_unique($temp);
        foreach ($temp as $k => $v){
            $a = explode(",",$v);
            $arr_after[$k]= array_combine($arr_inner_key,$a);
        }
        $arr_after=array_values($arr_after);
        return $arr_after;
    }

 

THE END

发表回复