PHPの二次元配列の重量除去

692 ワード

$arr = array(
    array('age' => 26, 'name' => '  '),
    array('age' => 23, 'name' => '  '),
    array('age' => 24, 'name' => '  '),
    array('age' => 23, 'name' => '  '),
    array('age' => 26, 'name' => '  ')
);
dump($arr);
foreach ($arr as $v) {
    $v = join(",", $v); //   ,    implode,                 
    $new_arr[] = $v;
}
$new_arr = array_unique($new_arr); //         ,          
foreach ($new_arr as $k => $v) {
    $new_arr[$k] = explode(",", $v); //            
}
dump($new_arr);
die;