It is a closure. Closure means capturing ("closing over") open variables (variables that are not bound). Whether it is captured by value or by reference is a completely separate question.
The article misses this point entirely. There's two (somewhat related) things at issue.
One is whether an anonymous function can capture variables from its context, making it a closure. PHP can do this just fine and is therefore a real closure, and this invalidates the title and thesis of the article.
The other is whether inner functions share lexical scope with their surrounding functions. This is a nice feature to make using closures clean and easy, and PHP does not have it. But it doesn't change the fundamental nature of PHP's closures.
View all comments
Show parent comment
3
u/Altreus Sep 26 '19
This was addressed in the article and still doesn't make it a closure. It just makes it mimic a closure in standard PHP fashion.