|
Posted by Richard Davey on 06/29/05 17:00
Hello Jochem,
Wednesday, June 29, 2005, 2:13:21 PM, you wrote:
JM> anybody here know what the logic is behind constant() triggering a
JM> warning if the named constant is not found?
JM> <?
JM> $cnst = "DEBUG";
JM> // what I want to do but can't
JM> if ($dbg = constant($cnst)) {
JM> // do stuff
JM> }
JM> // the only real option, it seems - bit long winded to get round a stupid (IMHO)
JM> if (defined($cnst) && ($dbg = constant($cnst))) {
JM> // do stuff
JM> }
Isn't the warning coming from the fact that $cnst isn't defined,
rather than coming from the constant() function itself?
Best regards,
Richard Davey
--
http://www.launchcode.co.uk - PHP Development Services
"I do not fear computers. I fear the lack of them." - Isaac Asimov
[Back to original message]
|