Re: [RFC] Alternative "use" syntax for Closures
| From: | Wes | Date: | Sat, 15 Jun 2019 22:37:01 +0000 |
| Subject: | Re: [RFC] Alternative "use" syntax for Closures | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-105942@lists.php.net to get a copy of this message | ||
Hi Kalle, I realize it's going to be a bit odd when binding by value. But
it's not that hard to grasp.
```
$a = 123;
$closure = function(){
use $a;
echo $a; // 123
};
$a = 345;
```
For this reason I specified it is mandatory to have
use only at the very
top (otherwise, it would _really_ be confusing :P)