Posted by Jochem Maas on 06/29/05 16:13
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
Navigation:
[Reply to this message]
|