[PHP] Re: constant() - php5

2005-06-29 Thread Jason Barnett
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;

?

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



Re: [PHP] Re: constant() - php5

2005-06-29 Thread Marek Kilimajer

Jason Barnett wrote:
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);


The above is wrong, use:
echo constant('UNDEFINED_CONSTANT');

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



Re: [PHP] Re: constant() - php5

2005-06-29 Thread Jason Barnett

Marek Kilimajer wrote:

Jason Barnett wrote:

...


?php

/* Causes E_WARNING */
echo constant(UNDEFINED_CONSTANT);



The above is wrong, use:
echo constant('UNDEFINED_CONSTANT');


OK, that's a good catch.  But this still causes an E_WARNING.

--
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php

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