Re: constant() - php5
| From: | Jason Barnett | Date: | Wed, 29 Jun 2005 13:39:49 +0000 |
| Subject: | Re: constant() - php5 | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-217815@lists.php.net to get a copy of this message | ||
Actually, thanks for pointing out this function to me because I never even knew that it existed. You learn something new every day.
I have to admit that a warning seems a little unusual given that an undefined variable would result in only an E_NOTICE. Especially since the default behavior for an undefined constant (anywhere except for this function) is an E_NOTICE. Seems like you may have found a bug to report.
<?php
/* Causes E_WARNING */
echo constant(UNDEFINED_CONSTANT);
/* Causes E_NOTICE */
echo UNDEFINED_CONSTANT;
?>