0
我有以下數組,我想與另一個數組合並。合併數組的值
2數組:(實際上有更多的項目在響應,但現在我想合併數組在特定的值)。
array (size=5)
'_index' => string 'pagespeed' (length=9)
'_type' => string 'ecostylenlresult' (length=16)
'_id' => string 'AVSaAaavHgv4xDNlwI0f' (length=20)
'_score' => float 1
'_source' =>
array (size=9)
'kind' => string 'pagespeedonline#result' (length=22)
'id' => string 'http://www.ecostyle.nl/' (length=23)
'responseCode' => int 200
'title' => string 'ECOstyle |' (length=10)
'ruleGroups' =>
array (size=1)
'SPEED' =>
array (size=1)
...
'pageStats' =>
array (size=10)
'numberResources' => int 60
'numberHosts' => int 7
'totalRequestBytes' => string '6997' (length=4)
'numberStaticResources' => int 56
'htmlResponseBytes' => string '40101' (length=5)
'cssResponseBytes' => string '332781' (length=6)
'imageResponseBytes' => string '2160470' (length=7)
'javascriptResponseBytes' => string '286189' (length=6)
'numberJsResources' => int 26
'numberCssResources' => int 14
'formattedResults' =>
array (size=2)
'locale' => string 'en_US' (length=5)
'ruleResults' =>
array (size=10)
...
'version' =>
array (size=2)
'major' => int 1
'minor' => int 15
0 => string 'ecostylenl_2016-05-10' (length=21)
array (size=5)
'_index' => string 'moz' (length=3)
'_type' => string 'ecostylenlresult' (length=16)
'_id' => string 'AVSaAZUbHgv4xDNlwI0c' (length=20)
'_score' => float 1
'_source' =>
array (size=12)
'fmrp' => float 5.1715406017042
'fmrr' => float 1.2509523237227E-8
'pda' => float 48.09425912773
'ueid' => int 3620
'uid' => int 7085
'umrp' => float 6.8994293440141
'umrr' => float 7.137551640113E-8
'upa' => float 56.852760548224
'us' => int 200
'ut' => string 'ECOstyle' (length=8)
'uu' => string 'www.ecostyle.nl/' (length=16)
0 =>
array (size=1)
'' => string 'ecostylenl_2016-05-10' (length=21)
在這兩個數組中,我具有相同的值。
0 => string 'ecostylenl_2016-05-10' (length=21)
我想使這1個數組,所以我有1個元素的所有結果。
這樣做的最好方法是什麼?
您可以檢查此http://stackoverflow.com/questions/14842272/php-array-merge-two-arrays-on-same-key –