Array ( [0] => Array ( [field_airline] => 18 [title] => FGGH [field_route_location] => Hongkong [field_time] => 01:10 )
[1] => Array ( [field_airline] => 19 [title] => DSSA [field_route_location] => Kuala Lumpur [field_time] => 01:10 ),
[2] => Array ( [field_airline] => 19 [title] => ASAS [field_route_location] => Kuala Lumpur [field_time] => 01:10 )
)
我想要的合并结果
Array ( [0] => Array ( [field_airline] => 18 [title] => FGGH [field_route_location] => Hongkong [field_time] => 01:10 ),
[1] => Array ( [field_airline] => 19 [title] => array(DSSA,ASAS) [field_route_location] => Kuala Lumpur [field_time] => 01:10)
)
我在尝试
<?php
$a= Array ( 0 => Array ( 'field_airline' => 18 ,
'title' => 'FGGH',
'field_route_location' => 'Hongkong',
'field_time' => '01:10'
),
1 => Array ( 'field_airline' => 19 ,
'title' => 'DSSA',
'field_route_location' => 'Kuala Lumpur',
'field_time' => '01:10'
),
2 => Array ( 'field_airline' => 19,
'title' => 'ASAS',
'field_route_location' => 'Kuala Lumpur',
'field_time' => '01:10'
)
);
$b = array();
foreach ($a as $key=>$value){
$b[$value['field_route_location']][] = $value;
}
echo '<pre>';
print_r($b);
echo '</pre>';
?>