最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

PHP array 的加法操作代碼

 更新時(shí)間:2010年07月24日 01:17:54   作者:  
PHP array 的加法操作過(guò)程中的一個(gè)問(wèn)題,大家可以繼續(xù)往下看。

The + operator appends elements of remaining keys from the right handed array to the left handed, whereas duplicated keys are NOT overwritten.

今天 再次看 php manual的時(shí)候,才知道

復(fù)制代碼 代碼如下:

<?php
$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:
復(fù)制代碼 代碼如下:

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"
}

原來(lái),我的理解就是。直接把$b中的元素直接復(fù)制到$a中。
我錯(cuò)了。

相關(guān)文章

最新評(píng)論

平遥县| 开封县| 霍州市| 昌黎县| 呼和浩特市| 徐汇区| 六枝特区| 邢台市| 九寨沟县| 尚义县| 吉安县| 革吉县| 太谷县| 光山县| 疏勒县| 固阳县| 内乡县| 宣汉县| 普洱| 宁化县| 长武县| 探索| 任丘市| 定州市| 抚远县| 慈溪市| 大宁县| 木里| 民和| 秦安县| 奉节县| 西昌市| 防城港市| 姚安县| 临夏县| 朝阳区| 桃园县| 同德县| 吐鲁番市| 全州县| 鸡东县|