如何在多维数组中合并结果?例如,如果我想制作餐馆指南并从2个来源抓取结果,并希望合并补充字段,如此示例(评级)并保留两个来源。
Array (
[0] => Array (
[source] => Google
[name] => Restaurant X
[lat] => -22.7
[lng] => -47.6
[google_rating] => 3
[facebook_rating] =>
)
[1] => Array (
[source] => Facebook
[name] => Restaurant X
[lat] => -22.7
[lng] => -47.6
[google_rating] =>
[facebook_rating] => 4
)
)
预期结果如下:
[0] => Array (
[source] => Google,Facebook
[name] => Restaurant X
[lat] => -22.7
[lng] => -47.6
[google_rating] => 3
[facebook_rating] => 4
)