When is a Closure not a Closure?
Answer: When it’s a PHP closure. It appears that PHP will have closures in 5.3. But as per usual, it does not work in ways that you would expect it to work. See the comment by “sapphirecat” on this . There still appears to be a problem when you “rope” off a global:
So they seem to have taken the usual half-broken approach: you can have read-only closures which are immune to changes to a global variable, or you can have read-write closures which remember changes, but those changes leak back into the global variable.
Oops! Closures are not supposed to do that! It sort of defeats the purpose of having closures in the first place. There is a workaround to the problem but that is one more quirk that you have to remember when working with PHP. Two steps forward, one step back.
