slightly improved example

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@150211 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Friedhelm Betz 2004-01-31 11:45:33 +00:00
parent 10a9a3e5a6
commit fe882e3c72

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.60 $ -->
<!-- $Revision: 1.61 $ -->
<chapter id="language.operators">
<title>Operators</title>
<simpara>
@ -814,8 +814,12 @@ $a .= "World!"; // now $a contains "Hello World!"
$a = array("a" => "apple", "b" => "banana");
$b = array("a" => "pear", "b" => "strawberry", "c" => "cherry");
$c = $a + $b;
$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);
?>
]]>
@ -824,6 +828,7 @@ var_dump($c);
When executed, this script will print the following:
<screen role="php">
<![CDATA[
Union of $a and $b:
array(3) {
["a"]=>
string(5) "apple"
@ -832,7 +837,15 @@ array(3) {
["c"]=>
string(6) "cherry"
}
Union of $b and $a:
array(3) {
["a"]=>
string(4) "pear"
["b"]=>
string(10) "strawberry"
["c"]=>
string(6) "cherry"
}
]]>
</screen>
</para>