"男","姓名"=>"不是女人"); $array4=array("性别"=>"不知道","长相"=>"很帅"); 哪么,合并之后,后者将会覆盖前者,这样合并之后就变成了 Array ( [性别] => 不知道 [姓名] => 不是女人 [长相] => 很帅 ) 数字型键名,或自动赋值键名,则不会产生覆"/> "男","姓名"=>"不是女人"); $array4=array("性别"=>"不知道","长相"=>"很帅"); 哪么,合并之后,后者将会覆盖前者,这样合并之后就变成了 Array ( [性别] => 不知道 [姓名] => 不是女人 [长相] => 很帅 ) 数字型键名,或自动赋值键名,则不会产生覆">

Heim  >  Artikel  >  Backend-Entwicklung  >  array_merge php array_merge下进行数组合并的代码

array_merge php array_merge下进行数组合并的代码

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

如 
$array3=array("性别"=>"男","姓名"=>"不是女人"); 
$array4=array("性别"=>"不知道","长相"=>"很帅"); 
哪么,合并之后,后者将会覆盖前者,这样合并之后就变成了 
Array ( [性别] => 不知道 [姓名] => 不是女人 [长相] => 很帅 ) 
数字型键名,或自动赋值键名,则不会产生覆盖, 
如 
$array1=array(1,2,3,4,5,6,7); 
$array2=array(1,7,8,9,10); 
合并之后,为 
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 )

以上就介绍了array_merge php array_merge下进行数组合并的代码,包括了array_merge方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn