Re: [Fwd: [PHP] constant() - php5]
| From: | Jochem Maas | Date: | Fri, 01 Jul 2005 13:25:25 +0000 |
| Subject: | Re: [Fwd: [PHP] constant() - php5] | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-17057@lists.php.net to get a copy of this message | ||
Pawel Bernat wrote:
its inconsistent to trigger an E_WARNING when doing: echo constant('CNST'); when: echo CNST; only triggers an E_NOTICE. (assuming, in both cases that CNST is not defined). IMHO it should at most trigger an E_NOTICE.<? $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 }What is stupid with validating name before using it?
p.