Did you read my post? I didn't say it was useless.The mere notion that the constant() function is useless or bad practice is utterly ridiculous and unfounded.
Acessing class constants dynamically
Moderator: General Moderators
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
- stereofrog
- Forum Contributor
- Posts: 386
- Joined: Mon Dec 04, 2006 6:10 am
Welcome to the php world.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.
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
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...Just because someone in php team once said it "looks weird" and "smells".
Code: Select all
foo()['bar']Code: Select all
list('bar' => $bar) = foo()