时间:2021-07-01 10:21:17 帮助过:12人阅读
Array( [0] => Array ( [id] => 2 [title] => 26 ) [1] => Array ( [id] =>3 [title] => 28 ) [2] => Array ( [id] => 2 [title] => 26 ) [3] => Array ( [id] => 7 [title] => 25 ))
Array( [0] => Array ( [id] => 2 [title] => 26 ) [1] => Array ( [id] =>3 [title] => 28 ) [3] => Array ( [id] => 7 [title] => 25 ))
$a = Array( Array( 'id' => 2, 'title' => 26 ), Array( 'id' => 3, 'title' => 28 ), Array( 'id' => 2, 'title' => 26 ), Array( 'id' => 7, 'title' => 25 ),);$res = array();foreach($a as $v) { if(! isset($res[$v['id']])) $res[$v['id']] = $v;}print_r(array_values($res));
Array( [0] => Array ( [id] => 2 [title] => 26 ) [1] => Array ( [id] => 3 [title] => 28 ) [2] => Array ( [id] => 7 [title] => 25 ))