[PHP-DEV] Re: Closures and __FUNCTION__

2009-04-13 Thread Justin Martin
Hi Peter, If I recall correctly, you can use the 'use' keyword. $factorial = function($foo) use ($factorial) { $factorial($foo); } $factorial('Hello World!'); I'm still having issues compiling 5.3 on my system, so I haven't tested this. Thanks, Justin Martin Peter Danenberg wrote: > T

[PHP-DEV] Re: Closures and __FUNCTION__

2009-04-13 Thread Justin Martin
In addendum I'd like to correct the syntax that I had someone in IRC test. Apparently it works as such: $foo = NULL; $foo = function($foo) use (&$foo) { ... } Still rather hackish, but better than globals I suppose? Thanks, Justin Martin Justin Martin wrote: > Hi Peter, > > If I recal

Re: [PHP-DEV] Re: Closures and __FUNCTION__

2009-04-13 Thread Peter Danenberg
Quoth Justin Martin on Pungenday, the 30th of Discord: > If I recall correctly, you can use the 'use' keyword. Thanks, Justin; that occurred to me, too. But the following results in "Notice: Undefined variable: factorial": $factorial = function($n) use ($factorial) { if ($n == 1)

Re: [PHP-DEV] Re: Closures and __FUNCTION__

2009-04-13 Thread Peter Danenberg
Quoth Justin Martin on Pungenday, the 30th of Discord: > Apparently it works as such: > > $foo = NULL; > $foo = function($foo) use (&$foo) { > ... > } > > Still rather hackish, but better than globals I suppose? Heh; amazing. I'm not going to pretend to comprehend this hack; but I'll use i

Re: [PHP-DEV] Re: Closures and __FUNCTION__

2009-04-13 Thread Justin Martin
Well, it's a rather simple bit of logic. First, we define $foo and load it with NULL so that it is available for referencing. Next, in terms of program logic, we create a closure with a lexical ('use') variable of a reference to $foo, which is then assigned to $foo. Thus, the reference to $foo in

Re: [PHP-DEV] Re: Closures and __FUNCTION__

2009-04-13 Thread Peter Danenberg
> First, we define $foo and load it with NULL so that it is available for > referencing. It turns out loading $foo is superfluous; I can get away with just: $foo = function($foo) use (&$foo) { $foo(); } > Next, in terms of program logic, we create a closure with a lexical > ('use') va

Re: [PHP-DEV] Re: Closures and __FUNCTION__

2009-04-13 Thread Justin Martin
I suppose it's an issue of cloning. Perhaps there's some difference between a cloned closure and a referenced closure? Thanks, Justin Martin Peter Danenberg wrote: >> First, we define $foo and load it with NULL so that it is available for >> referencing. > > It turns out loading $foo is superflu

[PHP-DEV] PHP 5 Bug Summary Report

2009-04-13 Thread internals
PHP 5 Bug Database summary - http://bugs.php.net/ Num Status Summary (1387 total -- which includes 842 feature requests) ===[*Directory/Filesystem functions] 46990 Assigned Passing UTF8 strings to filesystem functions produce wrong filenames ===

[PHP-DEV] PHP 6 Bug Summary Report

2009-04-13 Thread internals
PHP 6 Bug Database summary - http://bugs.php.net/ Num Status Summary (78 total -- which includes 32 feature requests) ===[*General Issues]== 26771 Suspended register_tick_funtions crash under threaded webservers ===

[PHP-DEV] Is it true that short_open_tag is deprecated in PHP 6?

2009-04-13 Thread Glen
- http://www.slideshare.net/thinkphp/php-53-and-php-6-a-look-ahead - http://wiki.claroline.net/index.php/Coding_Rules If it's not, then what are your thoughts on using ASP/JSP-style tags (<%), and perhaps making them the recommended option? I've just read through an old (and rather long) thread*

[PHP-DEV] Re: Is it true that short_open_tag is deprecated in PHP 6?

2009-04-13 Thread Jeremy
Glen wrote: It's short, and it doesn't conflict with XML. I have to say, I don't understand all the hate on short_open_tag. So what if it "conflicts" with XML? PHP is not XML. If you use an XML construct in your PHP, escape it. PHP can generate a lot of other languages, too -- should e

Re: [PHP-DEV] Re: Closures and __FUNCTION__

2009-04-13 Thread Marcin Kurzyna
Peter Danenberg pisze: Quoth Justin Martin on Pungenday, the 30th of Discord: If I recall correctly, you can use the 'use' keyword. Thanks, Justin; that occurred to me, too. But the following results in "Notice: Undefined variable: factorial": $factorial = function($n) use ($factorial) {

Re: [PHP-DEV] Re: Is it true that short_open_tag is deprecated in PHP 6?

2009-04-13 Thread Kalle Sommer Nielsen
2009/4/13 Jeremy : > Glen wrote: >> >> It's short, and it doesn't conflict with XML. >> > > I have to say, I don't understand all the hate on short_open_tag.  So what > if it "conflicts" with XML?  PHP is not XML.  If you use an XML construct in > your PHP, escape it.  PHP can generate a lot of oth

Re: [PHP-DEV] Re: Is it true that short_open_tag is deprecated in PHP 6?

2009-04-13 Thread James Logsdon
I think that's what he meant by "escape it". I haven't used short_open_tags myself much, but as I've been exploring templating options I like it for outputting variables. James Logsdon On Mon, Apr 13, 2009 at 2:24 PM, Kalle Sommer Nielsen wrote: > 2009/4/13 Jeremy : > > Glen wrote: > >> > >> It

Re: [PHP-DEV] Re: Is it true that short_open_tag is deprecated in PHP 6?

2009-04-13 Thread Glen
It was not my intention to initiate a massive debate regarding the use of short_open_tag. I posted for two reasons: 1. To ask if short_open_tag has been deprecated in PHP 6. 2. To suggest asp_tags as the recommended option for templating in PHP (to keep both crowds* happy). * The crowd *for* the

Re: [PHP-DEV] Re: Is it true that short_open_tag is deprecated in PHP 6?

2009-04-13 Thread Stanislav Malyshev
Hi! Thats because with short_open_tags on, you need to use: '); ?> It's a pretty small use case (that's a problem only if you have xml documents which has to have php code which has to be inlined) and as you see, can be easily handled. I think that should not make whole very useful syntax d

Re: [PHP-DEV] Re: Is it true that short_open_tag is deprecated in PHP 6?

2009-04-13 Thread Mike Panchenko
On Mon, Apr 13, 2009 at 1:06 PM, Stanislav Malyshev wrote: > It's a pretty small use case (that's a problem only if you have xml > documents which has to have php code which has to be inlined) and as you > see, can be easily handled. I think that should not make whole very useful > syntax depreca

Re: [PHP-DEV] Closures and __FUNCTION__

2009-04-13 Thread Stanislav Malyshev
Hi! The original anonymous functions patch[1] contained support for __FUNCTION__ as a recursion mechanism in closures, such that I should be able to do something like this: $factorial = function($n) { if ($n == 1) return 1; else return $n * call_user_func(__FUNCTIO

Re: [PHP-DEV] Re: Is it true that short_open_tag is deprecated in PHP 6?

2009-04-13 Thread Evert | Filemobile
On 13-Apr-09, at 4:06 PM, Stanislav Malyshev wrote: Hi! Thats because with short_open_tags on, you need to use: '); ?> It's a pretty small use case (that's a problem only if you have xml documents which has to have php code which has to be inlined) and as you see, can be easily handled.

Re: [PHP-DEV] Closures and __FUNCTION__

2009-04-13 Thread Peter Danenberg
> function Y($F) { > $func = function ($f) { return $f($f); }; > return $func(function ($f) use($F) { > return $F(function ($x) use($f) { > $ff = $f($f); > return $ff($x); > }); > }); > } That's interesting;

Re: [PHP-DEV] Re: Is it true that short_open_tag is deprecated in PHP 6?

2009-04-13 Thread Philip Olson
Today this topic may be the cloudiest and most heated in all of PHP. Here's the factual history of our poor little short_open_tag directive: php.ini values : short_open_tag PHP 4, 5_0 * Default

Re: [PHP-DEV] Re: Is it true that short_open_tag is deprecated in PHP 6?

2009-04-13 Thread Kenan Sulayman
Hey Guys, Whenever I start an XHTML document, I do escape it this way: Where the equals equals So, please do not deprecate it - because it's important for me :$ Thanks, (c) Kenan Sulayman Freelance Designer and Programmer Life's Live Poetry 2009/4/1

Re: [PHP-DEV] Re: Is it true that short_open_tag is deprecated in PHP 6?

2009-04-13 Thread Stan Vassilev | FM
Hi, A vote in support of short tags, although last time I checked they were not removed in PHP6 (and I hate to see this brought up once more). On top of that, the supposed XML conflict argument is not fully thought through, since full PHP tags are not XML compliant either: "; ?> In the above