philip          Sat May 31 18:37:28 2003 EDT

  Modified files:              
    /phpdoc/en/appendices       comparisons.xml 
  Log:
  Add undefined var and boolean true to the function comparison table, added 
  a note about if ($x) producing E_NOTICE for undefined variables.  And 
  clarified the boolean column means if ($x).  And, added some <type> references.
  
  
Index: phpdoc/en/appendices/comparisons.xml
diff -u phpdoc/en/appendices/comparisons.xml:1.3 
phpdoc/en/appendices/comparisons.xml:1.4
--- phpdoc/en/appendices/comparisons.xml:1.3    Fri May 30 18:18:10 2003
+++ phpdoc/en/appendices/comparisons.xml        Sat May 31 18:37:28 2003
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.3 $ -->
+<!-- $Revision: 1.4 $ -->
 <appendix id="types.comparisons">
  <title>PHP type comparison tables</title>
  <para>
@@ -16,7 +16,8 @@
   Before utilizing these tables, it's important to understand types and their
   meanings.  For example, <literal>"42"</literal> is a <type>string</type> 
   while <literal>42</literal> is an <type>integer</type>.  &false; is a
-  boolean while <literal>"false"</literal> is a string.
+  <type>boolean</type> while <literal>"false"</literal> is a
+  <type>string</type>.
  </para>
  <note>
   <para>
@@ -25,6 +26,14 @@
    <function>is_numeric</function>.
   </para>
  </note>
+ <note>
+  <para>
+   Simply doing <literal>if ($x)</literal> while <varname>$x</varname> is
+   undefined will generate an error of level <constant>E_NOTICE</constant>.
+   Instead, consider using <function>empty</function> or
+   <function>isset</function> and/or initialize your variables.
+  </para>
+ </note>
  <para>
   <table>
    <title>Comparisons of <varname>$x</varname> with PHP functions</title>
@@ -36,7 +45,7 @@
       <entry><function>empty</function></entry>
       <entry><function>is_null</function></entry>
       <entry><function>isset</function></entry>
-      <entry><type>boolean</type></entry>
+      <entry><type>boolean</type> : <literal>if($x)</literal></entry>
      </row>
     </thead>
     <tbody>
@@ -65,6 +74,14 @@
       <entry>&false;</entry>
      </row>
      <row>
+      <entry><varname>$x</varname> is undefined</entry>
+      <entry><type>NULL</type></entry>
+      <entry>&true;</entry>
+      <entry>&true;</entry>
+      <entry>&false;</entry>
+      <entry>&false;</entry>
+     </row>
+     <row>
       <entry><literal>$x = array();</literal></entry>
       <entry><type>array</type></entry>
       <entry>&true;</entry>
@@ -79,6 +96,14 @@
       <entry>&false;</entry>
       <entry>&true;</entry>
       <entry>&false;</entry>
+     </row>
+     <row>
+      <entry><literal>$x = true;</literal></entry>
+      <entry><type>boolean</type></entry>
+      <entry>&false;</entry>
+      <entry>&false;</entry>
+      <entry>&true;</entry>
+      <entry>&true;</entry>
      </row>
      <row>
       <entry><literal>$x = 1;</literal></entry>



-- 
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to