diff --git a/appendices/migration5.xml b/appendices/migration5.xml index 01b4640966..a9d80a0dd2 100755 --- a/appendices/migration5.xml +++ b/appendices/migration5.xml @@ -1,5 +1,5 @@ - + Migrating from PHP 4 to PHP 5 @@ -107,6 +107,17 @@ -1. + + + If there are functions defined in the included file, they can be used in the + main file independent if they are before return 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 include_once instead of + checking if the file was already included and conditionally return inside + the included file. + + include_once and require_once diff --git a/language/control-structures.xml b/language/control-structures.xml index f2aaf47aed..2de073da1f 100644 --- a/language/control-structures.xml +++ b/language/control-structures.xml @@ -1,5 +1,5 @@ - + Control Structures @@ -1500,6 +1500,15 @@ echo $bar; // prints 1 If the file can't be included, &false; is returned and E_WARNING is issued. + + If there are functions defined in the included file, they can be used in the + main file independent if they are before return 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 include_once instead of + checking if the file was already included and conditionally return inside + the included file. + A few other ways to "include" files into variables are with fopen, file or by using