代码:
复制代码 代码如下:
$a = array('a' => 'a', 'b' => 'b');
$b = array('c' => 'c', 'd' => 'd');
$c = $a + $b;
print('
'); <br>print_r($c); <br>print('
');
?>
结果:
复制代码 代码如下:
Array
(
[a] => a
[b] => b
[c] => c
[d] => d
)
注意:加号和array_merge()函数还是有区别的,就是当用加号合并数组时,如果数组间存在同名的键,那么保留前面数组对应的键值,而array_merge()函数正好相反。
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