RFC question (Re: [PHP-DEV] [PATCH] Allow use($var..) statement ubiquitously)
| From: | Moriyoshi Koizumi | Date: | Wed, 23 Jul 2008 16:21:35 +0000 |
| Subject: | RFC question (Re: [PHP-DEV] [PATCH] Allow use($var..) statement ubiquitously) | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-39235@lists.php.net to get a copy of this message | ||
I would like to keep this as a RFC page in wiki.php.net. Are there any conventions or rules that I should keep in mind? (or just-not-supposed-to-do-that-because-your-proposal-is-stupid-and-will-never-be-accepted?)
Moriyoshi
On 2008/07/18, at 8:23, Moriyoshi Koizumi wrote:
Hi, Attached are the patches that allow the "use" statement that was introduced with closures to appear within every function statement except method definitions. I think this feature is a good addition because it resolves inconsistency between closures and unticked functions. In a nutshell, <?php function foo() use (&$some_globals) {echo $some_globals;} ?> is equivalent to <?php function foo() {global $some_globals; echo $some_globals;} ?> While, <?php function bar() {$some_local_var = ''; function fubar() use (&$some_local_var) { echo $some_local_var; }} ?> and <?php function bar() {function fubar() { global $some_local_var; echo $some_local_var; }} ?> are of course not the same.<php-ubiquitous-use-statement-HEAD-20080718.patch.diff.txt><php-ubiquitous-use-statement-PHP_5.3-20080718.patch.diff.txt> Moriyoshi --PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php