T_AS in closures
| From: | Andrey Andreev | Date: | Wed, 05 Mar 2014 21:28:49 +0000 |
| Subject: | T_AS in closures | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-72945@lists.php.net to get a copy of this message | ||
Hi,
I was clicking on bugs.php.net/random today and I came across #54888,
which is a feature request for the following syntax:
$foo = 'whatever';
$bar = function() use ($foo as $baz) { /* use $baz here */ };
https://bugs.php.net/bug.php?id=54888
I don't know if other languages have it, but it seems nice and
considering how much developers prefer foreach() over other loops
because it allows them to "rename" the variable, I'm sure people would
love it.
Has this been discussed before? What are your opinions on it?
Regards,
Andrey Andreev.