note 70213 rejected from function.function-exists by colder
| From: | colder@php.net | Date: | Sat, 07 Oct 2006 01:56:36 +0000 |
| Subject: | note 70213 rejected from function.function-exists by colder | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-118167@lists.php.net to get a copy of this message | ||
Note Submitter: axiak _a-t_ mit (dot) edu
----
To this post:
neelam_ab2003 at yahoo dot co dot in
11-May-2006 12:06
<?php
/*PHP doesn't Support nested functions. I have tried following in PHP_VERSION - 5.1.2*/
function A(){}
function B(){
function C(){
function D(){}
}
}
. . .
Nor should it. To the code outside function B(), the function C does not exist (in its scope). If
you call function B(), the function C gets created (and by way of extension D) but then gets
destroyed by the time B finishes (garbage collection).
This is a very useful feature of PHP. Why would you need to know if function C exists and is not in
your scope?