PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<字符串运算符流程控制>
Last updated: Mon, 16 Jul 2012

数组运算符

PHP 仅有的一个数组运算符是 + 运算符。它把右边的数组附加到左边的数组后,但是重复的键值不会被覆盖。

$a = array("a" => "apple", "b" => "banana");
$b = array("a" =>"pear", "b" => "strawberry", "c" => "cherry");

$c = $a + $b;

var_dump($c);

执行后,此脚本会显示:
array(3) {
  ["a"]=>
  string(5) "apple"
  ["b"]=>
  string(6) "banana"
  ["c"]=>
  string(6) "cherry"
}

请参阅手册中“数组类型”和“数组函数”的有关章节。




<字符串运算符流程控制>
 Last updated: Mon, 16 Jul 2012
 
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://manual.phpv.net/
Last updated: Thu Jul 7 19:13:47 2005 CST