php 2 D配列重複value除去
769 ワード
$arr = array(
array('id' => 1,'name' => 'fedde', 'age' => 27),
array('id' => 2,'name' => 'grand' , 'age' => 31),
array('id' => 3,'name' => 'cesc' , 'age' => 27),
array('id' => 4,'name' => 'ozil' , 'age' => 26)
);
function arr_unique(&$arr, $key){
foreach($arr as $k => $v){
if(!($brr[$v[$key]])){
$brr[$v[$key]] = $v;
}
}
$arr=array_values($brr);
}