aidan           Wed Jan  5 18:52:58 2005 EDT

  Modified files:              
    /phpdoc/en/language operators.xml 
  Log:
  Gave the ternary operator its own sect2. I'll follow with a patch redirecting 
php.net/ternary to this page.
  
http://cvs.php.net/diff.php/phpdoc/en/language/operators.xml?r1=1.81&r2=1.82&ty=u
Index: phpdoc/en/language/operators.xml
diff -u phpdoc/en/language/operators.xml:1.81 
phpdoc/en/language/operators.xml:1.82
--- phpdoc/en/language/operators.xml:1.81       Thu Dec  9 03:09:48 2004
+++ phpdoc/en/language/operators.xml    Wed Jan  5 18:52:57 2005
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.81 $ -->
+<!-- $Revision: 1.82 $ -->
  <chapter id="language.operators">
   <title>Operators</title>
   <simpara>
@@ -493,31 +493,7 @@
      </programlisting>
     </informalexample> 
    </para>
-   <para>
-    Another conditional operator is the "?:" (or ternary) operator.
-    <informalexample>
-     <programlisting role="php">
-<![CDATA[
-<?php
-// Example usage for: Ternary Operator
-$action = (empty($_POST['action'])) ? 'default' : $_POST['action'];
 
-// The above is identical to this if/else statement
-if (empty($_POST['action'])) {
-    $action = 'default';
-} else {
-    $action = $_POST['action'];
-}
-?>
-]]>
-     </programlisting>
-    </informalexample> 
-    The expression <literal>(expr1) ? (expr2) : (expr3)</literal>
-    evaluates to <replaceable>expr2</replaceable> if
-    <replaceable>expr1</replaceable> evaluates to &true;, and
-    <replaceable>expr3</replaceable> if
-    <replaceable>expr1</replaceable> evaluates to &false;.
-   </para>
    <para>
     See also <function>strcasecmp</function>,
     <function>strcmp</function>,
@@ -525,6 +501,38 @@
     and the manual section on
     <link linkend="language.types">Types</link>.
    </para>
+
+   <sect2 id="language.operators.comparison.ternary">
+    <title>Ternary Operator</title>
+    <para>
+     Another conditional operator is the "?:" (or ternary) operator.
+     <example>
+      <title>Assigning a default value</title>
+      <programlisting role="php">
+ <![CDATA[
+ <?php
+ // Example usage for: Ternary Operator
+ $action = (empty($_POST['action'])) ? 'default' : $_POST['action'];
+
+ // The above is identical to this if/else statement
+ if (empty($_POST['action'])) {
+     $action = 'default';
+ } else {
+     $action = $_POST['action'];
+ }
+
+ ?>
+ ]]>
+      </programlisting>
+     </example> 
+     The expression <literal>(expr1) ? (expr2) : (expr3)</literal>
+     evaluates to <replaceable>expr2</replaceable> if
+     <replaceable>expr1</replaceable> evaluates to &true;, and
+     <replaceable>expr3</replaceable> if
+     <replaceable>expr1</replaceable> evaluates to &false;.
+    </para>
+   </sect2>
+
   </sect1>
 
   <sect1 id="language.operators.errorcontrol">

Reply via email to