Home  >  Article  >  Backend Development  >  Code for array merging under php array_merge_PHP tutorial

Code for array merging under php array_merge_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:51:08802browse

Such as

$array3=array("Gender"=>"Male","Name"=>"Not a woman");
$array4=array("Gender"=>"No Know","Looks"=>"Very handsome");

Well, after the merger, the latter will cover the former, so after the merger it becomes

Array ( [ Gender] => Don’t know [Name] => Not a woman [Looks] => Very handsome)



Numeric key name, or automatically assigned key name, will not Generate coverage,

such as

$array1=array(1,2,3,4,5,6,7);
$array2=array(1,7,8, 9,10); After

is merged, 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 )

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/319186.htmlTechArticleFor example, $array3=array("gender"="male", "name"="not a woman"); $array4=array("Gender"="I don't know", "Appearance"="Very Handsome"); Well, after merging, the latter will overwrite the former, so after merging...
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