constant() - php5
| From: | Jochem Maas | Date: | Wed, 29 Jun 2005 13:13:21 +0000 |
| Subject: | constant() - php5 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-217811@lists.php.net to get a copy of this message | ||
anybody here know what the logic is behind constant() triggering a warning
if the named constant is not found?
contrived example:
<?
$cnst = "DEBUG";
// what I want to do but can't
if ($dbg = constant($cnst)) {
// do stuff
}
// the only real option, it seems - bit long winded to get round a stupid (IMHO)
if (defined($cnst) && ($dbg = constant($cnst))) {
// do stuff
}
PLEASE - nobody need bother to tell me about the @ operator, I am
aware of it but I don't want to use it in this case.
thanks & rgds,
jochem