时间:2021-07-01 10:21:17 帮助过:18人阅读
- <br><!--?php <BR-->$a = array("a" => "apple", "b" => "banana"); <br>$b = array("a" => "pear", "b" => "strawberry", "c" => "cherry"); <br>$c = $a + $b; // Union of $a and $b <br>echo "Union of \$a and \$b: \n"; <br>var_dump($c); <br>$c = $b + $a; // Union of $b and $a <br>echo "Union of \$b and \$a: \n"; <br>var_dump($c); <br>?> <br> <br> <br>When executed, this script will print the following: <br>Union of $a and $b: <br><u></u> 代码如下:<pre class="brush:php;toolbar:false layui-box layui-code-view layui-code-notepad"><ol class="layui-code-ol"><li><br>array(3) { <br>["a"]=> <br>string(5) "apple" <br>["b"]=> <br>string(6) "banana" <br>["c"]=> <br>string(6) "cherry" <br>} <br>Union of $b and $a: <br>array(3) { <br>["a"]=> <br>string(4) "pear" <br>["b"]=> <br>string(10) "strawberry" <br>["c"]=> <br>string(6) "cherry" <br>} <br> <br>原来,我的理解就是。直接把$b中的元素直接复制到$a中。 <br>我错了。 </li></ol></pre>