Re: Closures in PHP
| From: | Richard Lynch | Date: | Mon, 14 Jan 2008 18:58:00 +0000 |
| Subject: | Re: Closures in PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-267241@lists.php.net to get a copy of this message | ||
On Thu, January 10, 2008 4:22 am, John Papas wrote:
> Is there any functionality in PHP similar to closures?
Sort of.
There is a create_function:
http://php.net/create_function
> Are there any plans to add it..?
There was discussion on the php-internals list last week about
replacing create_function or, rather, adding a new way to create a
closure-like thingie.
It would not have the full-blown closure behaviour you may be used to
from other languages.
And, actually, the implementation that seemed to get the most
approbation was a simple way to create a function as a kind of a
resource (like a MySQL connection resource) and then you could pass it
around and use it.
It still didn't have a full-blown closure behaviour, as I recall, of
keeping the entire environment at the time of the function defintion.
If you want something that esoteric, go use Lisp. :-)
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?