Re: PATCH: anonymous functions in PHP
| From: | Sara Golemon | Date: | Tue, 20 Mar 2007 23:59:07 +0000 |
| Subject: | Re: PATCH: anonymous functions in PHP | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-28504@lists.php.net to get a copy of this message | ||
Stanislav Malyshev wrote:
$_SCOPE doesn't need to be that special... It can just be an object with overloaded array access... Whenever a dim is fetched for that object, check current_execute_data->prev->symbol_table for the variable and return that. -SaraFWIW, this doesn't work with the other superglobals (in function context): sean@sarcasm:~$ php -r '$_GET["foo"] = "bar"; function baz() { $get = "_GET"; return ${$get}["foo"]; } $get = "_GET"; echo ${$get}["foo"], baz(), "\n";' bar Notice: Undefined variable: _GET in Command line code on line 1 (this is documented)Ouch... ok. But $_SCOPES[$foo] should work, shouldn't it?