#13568 [Opn->Csd]: PHP3 semantics have been retained for nested functions

From: Date: Thu, 28 Nov 2002 20:44:39 +0000
Subject: #13568 [Opn->Csd]: PHP3 semantics have been retained for nested functions
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969349993@lists.php.net to get a copy of this message
ID: 13568 Updated by: pollita@php.net Reported By: alvarez@st-oneline.net -Status: Open +Status: Closed Bug Type: Documentation problem Operating System: * PHP Version: 4.10 New Comment: Documentation at http://www.php.net/manual/en/functions.php updted. "Why conditional functions don't immediately exist." Previous Comments: ------------------------------------------------------------------------ [2002-09-09 08:14:10] hholzgra@php.net the new semantics that allows calling functions prior to their definition only works for functions defined in a global scope as soon as a function definition is within a conditional block or nested within another function the new function cannot be created at parse time as it is not known yet wether the condition will be met or the surrounding function ever called, so these functions are created at runtime instead when execution reaches this part of the code so it is rather obvious that you can't call such a function ahead of it's definition well, maybe not *that* obvious, reclassified as documentation problem ... ------------------------------------------------------------------------ [2001-12-14 14:01:10] yohgaki@php.net Parhaps, ZE2 should depreciate this syntax. I really want BNF for PHP. ------------------------------------------------------------------------ [2001-10-05 14:56:31] alvarez@st-oneline.net container (); a script to reproduce the error quickly. function container () { function nested_php3 () { echo "this will be output"; } nested_php3 (); nested_php4 (); function nested_php4 () { echo "this won't be output"; } } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=13568&edit=1

« previous php.doc (#969349993) next »