The + operator appends elements of remaining keys from the right handed array to the left handed, whereas duplicated keys are NOT overwritten.
今天 再次看 php manual的时候,才知道
DirCMS内容管理系统,是国内自主研发的一款功能强大而又不失小巧简洁的由PHP+Mysql架构的内容管理系统。DirCMS代码全部开源,便于使用者二次开发或定制;并采用简洁的模板标签技术,使制作模板更加容易,一般情况下,用DirCMS架构一个企业站只需半天时间即可,真正实现功能的简洁,实用,强大,灵活。可广泛应用于架构各类门户站,下载站,企业站,工作室等站点。
$a = array("a" => "apple", "b" => "banana");
$b = array("a" => "pear", "b" => "strawberry", "c" => "cherry");
$c = $a + $b; // Union of $a and $b
echo "Union of \$a and \$b: \n";
var_dump($c);
$c = $b + $a; // Union of $b and $a
echo "Union of \$b and \$a: \n";
var_dump($c);
?>
When executed, this script will print the following:
Union of $a and $b:
array(3) {
["a"]=>
string(5) "apple"
["b"]=>
string(6) "banana"
["c"]=>
string(6) "cherry"
}
Union of $b and $a:
array(3) {
["a"]=>
string(4) "pear"
["b"]=>
string(10) "strawberry"
["c"]=>
string(6) "cherry"
}
原来,我的理解就是。直接把$b中的元素直接复制到$a中。
我错了。










