note 45528 deleted from language.functions by tomsommer

From: Date: Thu, 09 Sep 2004 20:23:57 +0000
Subject: note 45528 deleted from language.functions by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-76343@lists.php.net to get a copy of this message
Note Submitter: ---- Something that has cropped up following migration to php5 and exception handling. Consider this code: <?php /*** start code snippet ***/ try { bar(); // this call ok foo(); // this call will fail function foo() { return "foo"; } foo(); // this call works now } catch (Exception $e) { // handle the exception } function bar() { return "bar"; } /*** end snippet ***/ ?> My guess is that php reads all function definitions that are in the file scope of the script, but any functions further down the scope list [eg block scope of the try block, or block scope of an if statement (ie conditional functions mentioned above)] are ignored until they are reached by the program flow. HTH Ben

« previous php.notes (#76343) next »