vrana Tue Jul 27 15:53:55 2004 EDT
Modified files:
/phpdoc/en/language control-structures.xml
Log:
Comparing return value of include (bug #15438)
http://cvs.php.net/diff.php/phpdoc/en/language/control-structures.xml?r1=1.97&r2=1.98&ty=u
Index: phpdoc/en/language/control-structures.xml
diff -u phpdoc/en/language/control-structures.xml:1.97
phpdoc/en/language/control-structures.xml:1.98
--- phpdoc/en/language/control-structures.xml:1.97 Fri Jul 23 15:29:10 2004
+++ phpdoc/en/language/control-structures.xml Tue Jul 27 15:53:55 2004
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.97 $ -->
+<!-- $Revision: 1.98 $ -->
<chapter id="language.control-structures">
<title>Control Structures</title>
@@ -1424,6 +1424,29 @@
variables within those tags and they will be introduced at whichever point
the file was included.
</simpara>
+ <para>
+ Because <function>include</function> is a special language costruct,
+ parentheses are not needed around its argument. Take care when comparing
+ return value.
+ <example>
+ <title>Comparing return value of include</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+// won't work, evaluated as include(('vars.php') == 'OK'), i.e. include('')
+if (include('vars.php') == 'OK') {
+ echo 'OK';
+}
+
+// works
+if ((include 'vars.php') == 'OK') {
+ echo 'OK';
+}
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
<para>
<note>
<simpara>