Home  >  Article  >  Backend Development  >  PHP array_merge()函数实现多个数组合并

PHP array_merge()函数实现多个数组合并

WBOY
WBOYOriginal
2016-06-23 13:28:19749browse

php代码段:

$arr1 = array(    'name' => '小明',    'sex' => 1,    'age' => 24, );$arr2 = array(    'type' => 'IT',    'status' => '正常',    'flag' => 1,     'sort' => 100,);//假如以上两个数组是从两个表里读取的数据,现在需要将他们合并到一起$userInfo = array_merge($arr1, $arr2);print_r($userInfo);

output:

array(

     'name' => '小明',
     'sex' => 1,
     'age' => 24,
     'type' => 'IT',
     'status' => '正常',
     'flag' => 1,
     'sort' => 100,

);

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