constant() - php5

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux