On 29/04/2021 10:25, Christian Schneider wrote:
Without a keyword like "var" to declare it, I think most users would assume that an 
initialisation like "$foo=null;" at the top of their closure would make a variable local.
This assumption by the users would be true as we are capturing by value, not by 
reference.


Not entirely. As currently implemented, the value would still be captured, and so use memory, prevent destructors firing, etc.

Compare 3v4l.org/Utd9j <https://3v4l.org/Utd9j> vs 3v4l.org/fpjbX <https://3v4l.org/fpjbX>


Regards,

--
Rowan Tommins
[IMSoP]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to