Re: Re: PATCH: anonymous functions in PHP

From: Date: Thu, 20 Dec 2007 18:02:01 +0000
Subject: Re: Re: PATCH: anonymous functions in PHP
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.internals 
Request: Send a blank email to internals+get-34151@lists.php.net to get a copy of this message
array_filter($my_data, function($test){ return 3 === ($test % 4) });
What's wrong with regular functions?
At risk of wading into yet circular another discussion on internals@, I was part of the original thread on this subject, and I agree with Stas here: unless they're real closure, they're pretty useless. Apart from saving a few keystrokes, the above could easily be changed to the following, which is much more clear, DOES compile at compile-time, and works without adding a new construct that looks like a closure, but is not indeed one: function aiusdyasdjkhasdIMASHEDTHEKEYBOARD($test){ return 3 === ($test % 4) } array_filter($my_data, 'aiusdyasdjkhasdIMASHEDTHEKEYBOARD'); // I copy & pasted the callback name; aren't modern computers fascinating?! (-: S

« previous php.internals (#34151) next »