note 104697 deleted from language.functions by danbrown
| From: | danbrown@php.net | Date: | Fri, 01 Jul 2011 16:46:19 +0000 |
| Subject: | note 104697 deleted from language.functions by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-181139@lists.php.net to get a copy of this message | ||
Note Submitter: Miguel Prez
----
PHP functions bite. Unlike anonymous functions, named functions are not closures and they cannot
access their static environment (i.e. no use clause).
Furthermore, the interpreter breaks miserably if you attempt to redefine a function or call an
undefined function, throwing an uncatchable error that may break your application horribly. So much
for custom error handlers.
Finally, named functions are not first-class values, and while you can set a variable to a string
with the name of the named function and use () on it to call the function, there's no real
function type for named functions, which means you can't tell function names from strings, and,
what's worse, it can be a security wart considering you may accidentally read such values from
files or user input, as they are mere strings.