Page 2 of 2

Posted: Mon Apr 30, 2007 3:08 am
by Ollie Saunders
The mere notion that the constant() function is useless or bad practice is utterly ridiculous and unfounded.
Did you read my post? I didn't say it was useless.

Posted: Mon Apr 30, 2007 4:22 am
by stereofrog
Ree wrote:
jmut wrote: You guys really amaze me. The problem is so simple and yet you make it look so complicated. I'm really trying to figure out what you're so confused about that it 'smells' or 'looks weird' to you. You don't seem to think dynamic method invocation is wrong, but using constants the same way is? Again, that would be ridiculous IMO.
Welcome to the php world. ;) Ever thought why "foo()['bar']" doesn't work in php? Or "$klass::foo()"? Or "empty(foo())"? Just because someone in php team once said it "looks weird" and "smells".

Posted: Mon Apr 30, 2007 4:26 am
by Ollie Saunders
Just because someone in php team once said it "looks weird" and "smells".
I would hazard a guess that the reason for most of those is because of the way PHP is written. empty() for example is a language construct and runs very quickly because no function call is necessary but this has limitations. That said I would really like...

Code: Select all

foo()['bar']
..to work...

Code: Select all

list('bar' => $bar) = foo()
...would be acceptable.