git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@87371 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Jan Lehnardt 2002-07-01 21:57:45 +00:00
parent 555d51632c
commit 8cbc437a8e
2 changed files with 42 additions and 2 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.37 $ -->
<!-- $Revision: 1.38 $ -->
<chapter id="language.operators">
<title>Operators</title>
<simpara>
@ -643,7 +643,42 @@ $a .= "World!"; // now $a contains "Hello World!"
</informalexample>
</para>
</sect1>
<sect1 id="language.operators.array">
<title>Array Operators</title>
<simpara>
The only array operator in PHP is the <literal>+</literal> operator.
It appends the right handed array to the left handed, whereas
duplicated keys are NOT overwritten.
</simpara>
<para>
<informalexample>
<programlisting role="php">
<![CDATA[
$a = array("a" => "apple", "b" => "banana");
$b = array("a" =>"pear", "b" => "strawberry", "c" => "cherry");
$c = $a + $b;
var_dump($c);
]]>
</programlisting>
<screen role="php">
<![CDATA[
array(3) {
["a"]=>
string(5) "apple"
["b"]=>
string(6) "banana"
["c"]=>
string(6) "cherry"
}
]]>
</screen>
</informalexample>
</para>
</sect1>
</chapter>
<!-- Keep this comment at the end of the file

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.5 $ -->
<!-- $Revision: 1.6 $ -->
<!-- splitted from ./en/functions/array.xml, last change in rev 1.2 -->
<refentry id="function.array-merge">
<refnamediv>
@ -98,6 +98,11 @@ Array
</para>
</example>
</para>
<note>
<para>
Shared keys will be overwritten on a first-come first-served basis.
</para>
</note>
<para>
See also <function>array_merge_recursive</function>.
</para>