Re: [PHP] insteadof considered harmful

2012-04-09 Thread Szczepan Hołyszewski
percent redundant. But perhaps there IS a purpose, only the examples in the manual fail to demonstrate it? Szczepan Hołyszewski -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] insteadof considered harmful

2012-04-09 Thread Szczepan Hołyszewski
OTH necessary to make the program unambiguous AND cannot be conveyed with the simple "Foo::tweak;" syntax. Absent such example, I consider "insteadof" harmful because it does nothing and adds a maintenance chore. It should be made optional and deprecated ASAP, and removed at

Re: [PHP] DOMNode children iteration (was Re: array() returns something weird)

2009-08-26 Thread Szczepan Hołyszewski
> I really can't see why you'd want to use references in the posted > loop anyway -- it's not likely to gain you any performance, and, as > I understand it, may actually run more slowly than the > non-reference version. The why is irrelevant. It is perfectly legal PHP, and while it might be illeg

Re: [PHP] DOMNode children iteration (was Re: array() returns something weird)

2009-08-26 Thread Szczepan Hołyszewski
e, in PHP when you write: $foo = array(); echo gettype($foo); the output should not be NULL, but in my example script (unmodified, with iteration by reference) things like this start happening at some point. Regards, Szczepan Hołyszewski -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] DOMNode children iteration (was Re: array() returns something weird)

2009-08-24 Thread Szczepan Hołyszewski
en, like a variable being NULL immediately after being assigned array(). I attach a demonstration. It is a self-contained commented script that you can execute from command line. Also attached is output on my machine. Best regards, Szczepan Hołyszewski <> THE GOOD WAY (DOMNodeList): Recur

Re: [PHP] array() returns something weird

2009-08-22 Thread Szczepan Hołyszewski
> Hm. . .it does look odd. Searching the bugs database at > http://bugs.php.net does turn up one other report (at > http://bugs.php.net/bug.php?id=47870 ) of array() returning NULL in > certain hard-to-duplicate circumstances on FreeBSD, Yes, I found it even before posting here, but I wasn't sure

Re: [PHP] array() returns something weird

2009-08-22 Thread Szczepan Hołyszewski
> What it looks like to me is that something is causing $foo to be a > string before the '$foo[] = "bar";' line is encountered. What do you > get if you put a gettype($foo); just before that line? > > >$foo=null; > >$foo[]="bar"; // <-- $foo simply becomes an array NULL. That

[PHP] array() returns something weird

2009-08-22 Thread Szczepan Hołyszewski
Hello! I am almost certain I am hitting some kind of bug. All of a sudden, array() stops returning an empty array and starts returning something weird. The weird thing behaves as NULL in most circumstances (e.g. gettype() says NULL), except: $foo=array(); // <-- weird thing return