Pawel Bernat wrote:
<?
$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?
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.
p.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php