note 95995 deleted from functions.anonymous by danbrown
| From: | danbrown@php.net | Date: | Tue, 02 Feb 2010 16:00:14 +0000 |
| Subject: | note 95995 deleted from functions.anonymous by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-165599@lists.php.net to get a copy of this message | ||
Note Submitter: bishamon
----
In response to (kwilson at shuttlebox dot net):
The global keyword always pulls from the global scope. In your test() function, $variable is in
test()'s local scope. When the function in $closure is called, the global statement goes out to
the global scope to find $variable.
This is just normal PHP variable scope behavior. It has nothing to do with anonymous functions or
closures (which are two separate, but related concepts).