Comment on Underscore.phpComments−erikpukinskis15yIf anyone else was surprised to see anonymous functions in PHP... apparently this is a new feature as of PHP 5.3.0 (released June last year).−judofyr15yAlso be aware that anonymous functions do not close over variables unless you specify so: http://php.net/manual/en/functions.anonymous.php−yuvipanda15yAnd they can not close over $this, which is annoying.−fooyc15yIt seems that it's fixed in PHP5.4; $this is the object in which you defined the closure by default, and you can re-bind it to any other object.−notJim15yPHP 5.3.0 was released in June of 2009, not 2010.
Comments
If anyone else was surprised to see anonymous functions in PHP... apparently this is a new feature as of PHP 5.3.0 (released June last year).
Also be aware that anonymous functions do not close over variables unless you specify so: http://php.net/manual/en/functions.anonymous.php
And they can not close over $this, which is annoying.
It seems that it's fixed in PHP5.4; $this is the object in which you defined the closure by default, and you can re-bind it to any other object.
PHP 5.3.0 was released in June of 2009, not 2010.