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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to