Hello Ryusuke,

 I have put your proposal as a link to a PHP GSoC 2008 idea here:
http://wiki.php.net/gsoc/2008

Feel invited to add to this idea in whatever way you want :-)

marcus

Saturday, February 23, 2008, 7:46:34 PM, you wrote:

> 2008/2/24, Andrei Zmievski <[EMAIL PROTECTED]>:
>> Do we have a working patch somewhere then?

> Hi, I have added support for closures to my patches.

> http://www.opendogs.org/pub/php-5.3-080223-anon.patch
> http://www.opendogs.org/pub/php-6.0-080223-anon.patch
> http://www.opendogs.org/pub/php-anon-tests-080223.tgz

> Example:
> <?php
> function get_counter($i = 0)
> {
>     /**
>      * 'static' modified anonymous function's
>      *  uninitialized (or null) static variables
>      *  are copied from the declared scope.
>      */
>     return static function(){
>         static $i;
>         return ++$i;
>     };
> }

> $c1 = get_counter();
> $c2 = get_counter(100);
> var_dump($c1(), $c2());
> var_dump($c1(), $c2());
> var_dump($c1(), $c2());
?>>

> For recursive calling of anonymous functions and closures,
> added function get_current_function_key().

> <?php
> $f = function($i = 0)
> {
>     echo "$i ";
>     if (++$i > 10) {
>         return;
>     }
>     $f = get_current_function_key();
>     $f($i);
> };

> $f();
?>>


> And here is a Zend extension for PHP 5.2 which enables
> anonymous functions, closures and square bracket arrays.

> http://www.opendogs.org/pub/php_qiq-0.1.0pre.tgz

> This has a few more features, but, at present, there is
> no document...


> Regards,




Best regards,
 Marcus


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to