Make include returns a lot more clear.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@327094 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Karoly Negyesi 2012-08-13 07:15:46 +00:00
parent ae5307ffe0
commit 2177c63915

View file

@ -181,16 +181,19 @@ include 'file.php'; // Works.
information.
</para>
<simpara>
Handling Returns: It is possible to execute a <function>return</function>
statement inside an included file in order to terminate processing in that
file and return to the script which called it. Also, it's possible to return
values from included files. You can take the value of the include call as
you would for a normal function. This is not, however, possible when including
remote files unless the output of the remote file has
<link linkend="language.basic-syntax.phpmode">valid PHP start
and end tags</link> (as with any local file). You can declare the needed
variables within those tags and they will be introduced at whichever point
the file was included.
Handling Returns: <literal>include</literal> always returns
<literal>FALSE</literal> on failure. Unless overridden by the included file,
<literal>include</literal> returns <literal>1</literal> if the include was
successful. It is possible to execute a <function>return</function>
statement inside an included file in order to terminate processing in
that file and return to the script which called it. Also, it's possible
to return values from included files. You can take the value of the
include call as you would for a normal function. This is not, however,
possible when including remote files unless the output of the remote
file has <link linkend= "language.basic-syntax.phpmode">valid PHP start
and end tags</link> (as with any local file). You can declare the
needed variables within those tags and they will be introduced at
whichever point the file was included.
</simpara>
<para>
Because <literal>include</literal> is a special language construct,