PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
The example was stripped-down from a more complex program that was giving me fits. Since the echo statement in the real program contains string literals and I was counting on variable interpolation, rev's "quotless" solution won't help. (...but there's no way for him to know that from the example I posted).
Either the solution with the braces or the unquoted variable name as the hash key (despite the constant lookup speed penalty) will probably solve the problem nicely.
Or not... as people have said before, php will look for a constant titled 'id'.. which slows down the script..
since we are already in a string-literal there's no need for the quotes. It really works, produces no errors or warnings and is consistent from php/zend's point of view
most times I (double-)check what I propose - if not I mark this fault ( or should go to bed)