vrana           Fri Jan 30 04:31:30 2004 EDT

  Modified files:              
    /phpdoc/en/language operators.xml types.xml 
    /phpdoc/en/reference/array  reference.xml 
  Log:
  Comparison operators (#27090)
  
http://cvs.php.net/diff.php/phpdoc/en/language/operators.xml?r1=1.59&r2=1.60&ty=u
Index: phpdoc/en/language/operators.xml
diff -u phpdoc/en/language/operators.xml:1.59 phpdoc/en/language/operators.xml:1.60
--- phpdoc/en/language/operators.xml:1.59       Thu Jan 15 05:01:55 2004
+++ phpdoc/en/language/operators.xml    Fri Jan 30 04:31:29 2004
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.59 $ -->
+<!-- $Revision: 1.60 $ -->
  <chapter id="language.operators">
   <title>Operators</title>
   <simpara>
@@ -455,7 +455,9 @@
    </para>
    <para>
     See also <function>strcasecmp</function>,
-    <function>strcmp</function>, and the manual section on
+    <function>strcmp</function>,
+    <link linkend="language.operators.array">Array operators</link>,
+    and the manual section on
     <link linkend="language.types">Types</link>.
    </para>
   </sect1>
@@ -755,18 +757,62 @@
   
   <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 
+   <table>
+    <title>Array Operators</title>
+    <tgroup cols="3">
+     <thead>
+      <row>
+       <entry>Example</entry>
+       <entry>Name</entry>
+       <entry>Result</entry>
+      </row>
+     </thead>
+     <tbody>
+      <row>
+       <entry>$a + $b</entry>
+       <entry>Union</entry>
+       <entry>Union of $a and $b.</entry>
+      </row>
+      <row>
+       <entry>$a == $b</entry>
+       <entry>Equality</entry>
+       <entry>&true; if $a and $b have the same elements.</entry>
+      </row>
+      <row>
+       <entry>$a === $b</entry>
+       <entry>Identity</entry>
+       <entry>&true; if $a and $b have the same elements in the same order.</entry>
+      </row>
+      <row>
+       <entry>$a != $b</entry>
+       <entry>Inequality</entry>
+       <entry>&true; if $a is not equal to $b.</entry>
+      </row>
+      <row>
+       <entry>$a &lt;&gt; $b</entry>
+       <entry>Inequality</entry>
+       <entry>&true; if $a is not equal to $b.</entry>
+      </row>
+      <row>
+       <entry>$a !== $b</entry>
+       <entry>Non-identity</entry>
+       <entry>&true; if $a is not identical to $b.</entry>
+      </row>
+     </tbody>
+    </tgroup>
+   </table>
+   <para>
+    The <literal>+</literal> operator
+    appends the right handed array to the left handed, whereas 
     duplicated keys are NOT overwritten.
-   </simpara>
+   </para>
    <para>
     <informalexample>
      <programlisting role="php">
 <![CDATA[
 <?php
 $a = array("a" => "apple", "b" => "banana");
-$b = array("a" =>"pear", "b" => "strawberry", "c" => "cherry");
+$b = array("a" => "pear", "b" => "strawberry", "c" => "cherry");
 
 $c = $a + $b;
 
@@ -791,6 +837,26 @@
     </screen>
    </para>
    <para>
+    Elements of arrays are equal for the comparison if they have the
+    same key and value.
+   </para>
+   <para>
+    <example>
+     <title>Comparing arrays</title>
+     <programlisting role="php">
+<![CDATA[
+<?php
+$a = array("apple", "banana");
+$b = array(1 => "banana", "0" => "apple");
+
+var_dump($a == $b); // bool(true)
+var_dump($a === $b); // bool(false)
+?>
+]]>
+     </programlisting>
+    </example>
+   </para>
+   <para>
     See also the manual sections on the 
     <link linkend="language.types.array">Array type</link> and 
     <link linkend="ref.array">Array functions</link>.
http://cvs.php.net/diff.php/phpdoc/en/language/types.xml?r1=1.133&r2=1.134&ty=u
Index: phpdoc/en/language/types.xml
diff -u phpdoc/en/language/types.xml:1.133 phpdoc/en/language/types.xml:1.134
--- phpdoc/en/language/types.xml:1.133  Sun Jan  4 20:16:59 2004
+++ phpdoc/en/language/types.xml        Fri Jan 30 04:31:29 2004
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.133 $ -->
+<!-- $Revision: 1.134 $ -->
  <chapter id="language.types">
   <title>Types</title>
 
@@ -1774,6 +1774,14 @@
     </para>
    </sect2>
 
+   <sect2 id="language.types.array.comparing">
+    <title>Comparing</title>
+    <para>
+     It is possible to compare arrays by <function>array_diff</function> and
+     by <link linkend="language.operators.array">Array operators</link>.
+    </para>
+   </sect2>
+
    <sect2 id="language.types.array.examples">
     <title>Examples</title>
     <para>
http://cvs.php.net/diff.php/phpdoc/en/reference/array/reference.xml?r1=1.10&r2=1.11&ty=u
Index: phpdoc/en/reference/array/reference.xml
diff -u phpdoc/en/reference/array/reference.xml:1.10 
phpdoc/en/reference/array/reference.xml:1.11
--- phpdoc/en/reference/array/reference.xml:1.10        Tue Jun 10 03:02:20 2003
+++ phpdoc/en/reference/array/reference.xml     Fri Jan 30 04:31:30 2004
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.10 $ -->
+<!-- $Revision: 1.11 $ -->
  <reference id="ref.array">
   <title>Array Functions</title>
   <titleabbrev>Arrays</titleabbrev>
@@ -22,6 +22,8 @@
      Please see the <link linkend="language.types.array">Arrays</link>
      section of the manual for a detailed explanation of how arrays are
      implemented and used in PHP.
+     See also <link linkend="language.operators.array">Array operators</link>
+     for other ways how to manipulate the arrays.
     </para>
    </section>
 

Reply via email to