php: rfc: closures (via) I never thought I’d see the day, but a patch adding closures to PHP has been both proposed and accepted! Looks like a solid implementation—the syntax is similar to JavaScript but makes explicit which variables are to be captured. As with much of PHP, values are copied in to the closure by default but you can use an ampersand to specify JavaScript-style pass-by-reference instead.
Now if they'd just add the Traits patch...
Charles - 21st July 2008 19:41 - #
I'd like to be greedy and ask for one more thing: the ability to pass a function by name as a callback. It feels dirty to pass function names as strings.