Re: constant() - php5

From: Date: Wed, 29 Jun 2005 14:00:06 +0000
Subject: Re: constant() - php5
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-217819@lists.php.net to get a copy of this message
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

« previous php.general (#217819) next »