php如何实现两个数组合并
时间:2021-07-01 10:21:17
帮助过:16人阅读
php怎么实现两个数组合并
数组一:
$a_array = Array
(
[0] => Array
(
[plan_id] => 1
[ad_img_url] => http://www.adsload.com/assets/ad1.jpg
)
[1] => Array
(
[plan_id] => 2
[ad_img_url] => http://www.adsload.com/assets/ad2.jpg
)
[2] => Array
(
[plan_id] => 3
[ad_img_url] => http://www.adsload.com/assets/ad3.jpg
)
)
数组二:
$b_array = Array
(
[0] => Array
(
[plan_id] => 1
[ad_url] => http://www.baidu.com/
)
[1] => Array
(
[plan_id] => 2
[ad_url] => http://www.baidu.com/
)
[2] => Array
(
[plan_id] => 3
[ad_url] => http://www.baidu.com/
)
)
合并后:
$ressult_array = Array
(
[0] => Array
(
[plan_id] => 1
[ad_img_url] => http://www.adsload.com/assets/ad1.jpg
[ad_url] => http://www.baidu.com/
)
[1] => Array
(
[plan_id] => 2
[ad_img_url] => http://www.adsload.com/assets/ad2.jpg
[ad_url] => http://www.baidu.com/
)
[2] => Array
(
[plan_id] => 3
[ad_img_url] => http://www.adsload.com/assets/ad3.jpg
[ad_url] => http://www.baidu.com/