|
Posted by gosha bine on 04/17/07 11:29
On 16.04.2007 18:47 lawrence k wrote:
>
> You misunderstood the question. I was asking "Does PHP support
> closures?" That was the question. I like using closures in languages
> such as Ruby and Javascript. I was wondering if there was any way to
> do so in PHP. I'm assuming the answer is no.
>
>
hi there
php doesn't support closures directly, because function declarations are
processed at compile time and create_function() deals only with strings.
However, with some hacking it's possible to emulate closures (or,
rather, partial application) using eval or create_function. See e.g.
http://www.tagarga.com/blok/on/061218
--
gosha bine
extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
Navigation:
[Reply to this message]
|