and in Python 1.0 in 1994.
Also, I can find no reference to PHP having anonymous functions/lambdas prior to 5.3, which is the version number given in both the linked article and PHP docs.
Also, I can find no reference to PHP having anonymous functions/lambdas prior to 5.3, which is the version number given in both the linked article and PHP docs.
The key thing with a lambda in python is that it is defined at the usage site.
so you can do:
filter(lambda x: x > 42, mylist)
Whereas in php that would be: $mylambda = create_function('$x','return $x > 42;');
filter($mylambda, $mylist);
Yes, the usage strings as code adds yet another level of WTF to this example.Note that php.net/create_function even points you to their page on actual anonymous functions, which they erroneously claim are the same as closures.