php如何实现两个数组合并
程序员文章站
2024-02-08 19:29:04
...
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/
数组一:
$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/
相关文章
相关视频