我必须将 2 个数组合并为一个数组,因为我已经尝试过 -
$TotalResult = array_merge_recursive($arr1, $arr2);
但是我没有通过这个功能得到想要的结果。
我的 2 个数组是:
$arr1 = Array(
[0] => Array
(
[search_terms] => facebook
[search_count] => 1
)
[1] => Array
(
[search_terms] => yahoomail.com
[search_count] => 1
)
[2] => Array
(
[search_terms] => google.com
[search_count] => 1
)
[3] => Array
(
[search_terms] => rediff.com
[search_count] => 2
)
);
$arr2=Array(
[0] => Array
(
[search_terms] => youtube
[adclicks_count] => 1
)
[1] => Array
(
[search_terms] => hotmail
[adclicks_count] => 4
)
[2] => Array
(
[search_terms] => facebook
[adclicks_count] => 2
)
[3] => Array
(
[search_terms] => google.com
[adclicks_count] => 3
)
[4] => Array
(
[search_terms] => yahoomail
[adclicks_count] => 1
)
[5] => Array
(
[search_terms] => stackoverflow
[adclicks_count] => 1
)
);
我希望得到的数组 3 如下 -
$arr3 = Array(
[0] => Array
(
[search_terms] => facebook
[search_count] => 1
[adclicks_count] => 2
)
[1] => Array
(
[search_terms] => yahoomail.com
[search_count] => 1
[adclicks_count] => 1
)
[2] => Array
(
[search_terms] => google.com
[search_count] => 1
[adclicks_count] => 3
)
[3] => Array
(
[search_terms] => rediff.com
[search_count] => 2
[adclicks_count] => 0
)
[4] => Array
(
[search_terms] => youtube
[search_count] => 0
[adclicks_count] => 1
)
[5] => Array
(
[search_terms] => hotmail
[search_count] => 0
[adclicks_count] => 4
)
[6] => Array
(
[search_terms] => stackoverflow
[search_count] => 0
[adclicks_count] => 1
)
);
请建议我在 php.ini 中是否有任何可用的解决方案。