$arr = [ 0 => [ 'id' => 1, 'name' => '张三', 'phone' => '123456789' ], 1 => [ 'id' => 2, 'name' => '李四', 'phone' => '456789' ], 3 => [ 'id' => 1, 'name' => '张三1', 'phone' => '1234567890' ], 4 => [ 'id' => 1, 'name' => '张三2', 'phone' => '12345678901' ], 5 => [ 'id' => 2, 'name' => '李四1', 'phone' => '12345678666' ] ]; $arr1 = []; foreach($arr as $v){ if(!isset($arr1[$v['id']])){ $arr1[$v['id']] = [ 'id' => $v['id'], 'info' => [[ 'name' => $v['name'], 'phone' => $v['phone'], ]], ]; }else{ $arr1[$v['id']]['info'][] = [ 'name' => $v['name'], 'phone' => $v['phone'], ]; } } print_r($arr1);