PHP implements two arrays to add the method, the PHP implementation of the array addition
The example in this article describes how PHP implements the addition of two arrays. Share to everyone for your reference. Specific as follows:
Example 1:
<?PHP$ARR1 = Array ("A" = "Chaoyang", "B" and "Haidian"); $arr 2 = Array ("h" = "Xicheng", "a" and "Dongcheng", "b" = "Fengtai"); $arr = $ arr1 + $arr 2;echo "";p Rint_r ($arr);? >
The output results are as follows:
Array ( [A] = Chaoyang [b] = Haidian [h] = Xicheng)
Change the order of additions, Example 2:
<?PHP$ARR1 = Array ("A" = "Chaoyang", "B" and "Haidian"); $arr 2 = Array ("h" = "Xicheng", "a" = "Dongcheng", "B" = "Fengtai"); $arr = $arr 2 + $arr 1;echo "";p Rint_r ($arr);?
The output is as follows:
array ([h] = Xicheng [A] = Dongcheng [b] = Fengtai)
From the above two examples, you can see:
The (1) addition is the following array, which is added to the previous array;
(2) The key name is not overwritten.
Hopefully this article will help you with your PHP programming.
http://www.bkjia.com/phpjc/959114.html www.bkjia.com true http://www.bkjia.com/phpjc/959114.html techarticle php implementation of the two arrays to add the method, PHP implementation of the array add the example of this article describes the PHP implementation of the two arrays to add the method. Share to everyone for your reference. As follows: Example 1: ...