在php中合并两个数组,重复删除

时间:2017-04-25 06:27:08

标签: php

我希望在PHP中合并以下数组

array 1 = 
[0] 
    (
        [roll_id] => 1
        [vendor_id] => 1
    )
[1] 
    (
        [roll_id] => 2
        [vendor_id] => 1
    )

Array 2 = 
[0]         
   (
        [roll_id] => 1
        [roll_name] => Manager
        [roll_discription] => 
    )
[1] 
    (
        [roll_id] => 2
        [roll_name] => Store Leader
        [roll_discription] => 
    )

这样

Array 3 = 
 [0]    
   (
        [roll_id] => 1
        [roll_name] => Manager
        [roll_discription] => 
        [vendor_id] => 1
    )

[1] 
    (
        [roll_id] => 2
        [roll_name] => Store Leader
        [roll_discription] =>
        [vendor_id] => 1 
    )

我理解使用循环我可以这样做,希望使用一些内置函数,如array_merge,array_unique。

0 个答案:

没有答案