Re: nested functions
| From: | Andrei Zmievski | Date: | Fri, 02 Feb 2001 14:21:44 +0000 |
| Subject: | Re: nested functions | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-45609@lists.php.net to get a copy of this message | ||
On Fri, 02 Feb 2001, Hartmut Holzgraefe wrote:
>
> it is right now possible to declare functions within functions
> (see bug#9064)
>
> this will lead to redeclaration errors if you call the outer
> function more then once
>
> i'm not sure about it, is this a usefull feature (although it
> behaves very different to, say, PASCAL or gcc with nested
> functions enabled where the inner function is 'local' to the
> namespace of the outer one) or should the engine prevent
> nested function declarations in the first place?
How about a simple check:
function outer()
{
if (!function_exists('inner')) {
function inner() {
}
}
}
-Andrei
* Entropy isn't what it used to be. *