I ran into this and found it interesting. Someone has added support for anonymous functions in PHP.
With the patch you can now do stuff like:
[code lang=”php”]
$data = array(“zoo”, “orange”, “car”, “lemon”, “apple”);
usort($data, function($a, $b) { return strcmp($a, $b); });
var_dump($data); # data is sorted alphabetically
[/code]
Before you had to use a funky function generation call.
[tags]php[/tags]
I stopped following the discussion after a while (and any discussion on the Internals Mailing List). I’m more interested in if they are going to have it in the next version of PHP. The patch is easy enough that you can add it yourself.
It is good that people with more karma was able to come in and support the idea.
Ah, that sounds absolutely delightful! I’ve always found JavaScript’s first-class treatment of anonymous functions quite helpful, it’s nice to see it come into PHP now.
Edward: it’s not first-class function. thing which gets into php is much simplier…
though, it’s still not applied to the tree, as far as I know