"Male","Name"=>"Not a woman"); $array4=array("Gender"=>"No I know","looks"=>"very handsome"); Well, after merging, the latter will overwrite the former, so that after merging, it becomes Array ([Gender] => Don't know [Name] => Not a woman [Looks] => very handsome) Numeric key name, or automatically assigned key name, will not cause overwrite"/> "Male","Name"=>"Not a woman"); $array4=array("Gender"=>"No I know","looks"=>"very handsome"); Well, after merging, the latter will overwrite the former, so that after merging, it becomes Array ([Gender] => Don't know [Name] => Not a woman [Looks] => very handsome) Numeric key name, or automatically assigned key name, will not cause overwrite">

Home  >  Article  >  Backend Development  >  array_merge php array_merge code for array merging

array_merge php array_merge code for array merging

WBOY
WBOYOriginal
2016-07-29 08:38:271004browse

For example,
$array3=array("Gender"=>"Male","Name"=>"Not a woman");
$array4=array("Gender"=>"Don't know","Appearance"= >"Very handsome");
Well, after the merger, the latter will overwrite the former, so that after the merger it becomes
Array ([Gender] => I don’t know [Name] => Not a woman [Looks like] ] => Very cool)
Numeric key names, or automatically assigned key names, will not cause overwriting,
For example,
$array1=array(1,2,3,4,5,6,7);
$ array2=array(1,7,8,9,10);
After merging, it is
Array ([0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 [6] => 7 [7] => 1 [8] => 7 [9] => 8 [10] => 9 [11] => 10 )

The above introduces the code for array merging under array_merge php array_merge, including the content of array_merge. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
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