From 49d06d7d6c510e667326ae0a2ffde13ce1cebae0 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Wed, 21 Dec 2005 15:04:47 +0000 Subject: [PATCH] Example when 'declare class before use' is necessary git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@203386 c90b9560-bf6c-de11-be94-00142212c4b1 --- appendices/migration5.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/appendices/migration5.xml b/appendices/migration5.xml index 925a14db02..072e1fc587 100755 --- a/appendices/migration5.xml +++ b/appendices/migration5.xml @@ -1,5 +1,5 @@ - + Migrating from PHP 4 to PHP 5 @@ -96,8 +96,9 @@ In some cases classes must be declared before used. It only happens - only if some of the new features of PHP 5 are used. Otherwise the - behaviour is the old. + only if some of the new features of PHP 5 (such as interfaces) are used. + Otherwise the behaviour is the old. @@ -127,11 +128,10 @@ - If there are functions defined in the included file, they will be defined - in the main file, whether they are before or after the - return instruction. If the file is included twice, - PHP 5 issues fatal error because functions were already declared, while - PHP 4 doesn't complain about it. + 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.