Home > Backend Development > PHP Tutorial > php如何实现两个数组合并

php如何实现两个数组合并

WBOY
Release: 2016-06-13 12:44:56
Original
1071 people have browsed it

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/

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template