mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Functions are defined even if they are after return statement in included file (bug #26032)
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@164493 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
de8441e907
commit
6441e07fbe
2 changed files with 22 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.27 $ -->
|
||||
<!-- $Revision: 1.28 $ -->
|
||||
<appendix id="migration5">
|
||||
<title>Migrating from PHP 4 to PHP 5</title>
|
||||
|
||||
|
@ -107,6 +107,17 @@
|
|||
<literal>-1</literal>.
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
If there are functions defined in the included file, they can be used in the
|
||||
main file independent if they are before <function>return</function> or after.
|
||||
If the file is included twice, PHP 5 issues fatal error because functions
|
||||
were already declared, while PHP 4 doesn't complain about it.
|
||||
It is recommended to use <function>include_once</function> instead of
|
||||
checking if the file was already included and conditionally return inside
|
||||
the included file.
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<function>include_once</function> and <function>require_once</function>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.100 $ -->
|
||||
<!-- $Revision: 1.101 $ -->
|
||||
<chapter id="language.control-structures">
|
||||
<title>Control Structures</title>
|
||||
|
||||
|
@ -1500,6 +1500,15 @@ echo $bar; // prints 1
|
|||
If the file can't be included, &false; is returned and
|
||||
<literal>E_WARNING</literal> is issued.
|
||||
</simpara>
|
||||
<para>
|
||||
If there are functions defined in the included file, they can be used in the
|
||||
main file independent if they are before <function>return</function> or after.
|
||||
If the file is included twice, PHP 5 issues fatal error because functions
|
||||
were already declared, while PHP 4 doesn't complain about it.
|
||||
It is recommended to use <function>include_once</function> instead of
|
||||
checking if the file was already included and conditionally return inside
|
||||
the included file.
|
||||
</para>
|
||||
<simpara>
|
||||
A few other ways to "include" files into variables are with
|
||||
<function>fopen</function>, <function>file</function> or by using
|
||||
|
|
Loading…
Reference in a new issue