Home > Backend Development > PHP Tutorial > php array_merge下进行数组合并的代码_PHP

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

WBOY
Release: 2016-06-01 12:24:29
Original
726 people have browsed it

如 

$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 )

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template