php 二维数组通过键去重

function array_unset_tt($arr,$key){     
        //建立一个目标数组  
    $res = array();        
    foreach ($arr as $value) {           
       //查看有没有重复项  
       if(isset($res[$value[$key]])){  
             //有:销毁  
             unset($value[$key]);  
       }  
       else{    
            $res[$value[$key]] = $value;  
       }    
    }  
    return $res;  
}  

你可能感兴趣的:(php 二维数组通过键去重)