mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Comparing return value of include (bug #15438)
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@164487 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
90e7198702
commit
64c2c97264
1 changed files with 24 additions and 1 deletions
|
@ -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 @@ if ($condition) {
|
|||
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>
|
||||
|
|
Loading…
Reference in a new issue