note 57288 added to language.constants
| From: | nickdotbrownatcoedotint at osu1 dot php dot net | Date: | Thu, 29 Sep 2005 14:52:21 +0000 |
| Subject: | note 57288 added to language.constants | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-95980@lists.php.net to get a copy of this message | ||
I have been happily including constant definitions without putting the name of the constant in
quotes:
define(c_bilingual_yes, "Yes@@Oui");
define(c_bilingual_no, "No@@Non");
Today I switched on a lot of error checking flags (E_ALL) and got strange messages ("using an
undefined from some of my define() statements:
Notice: Use of undefined constant c_bilingual_yes - assumed 'c_bilingual_yes' in
/var/www/nick/subscribe.php on line 20
The constants giving the problem are the ones that are in my main script body, rather than the ones
in the include files. Specifically, it appears that, if you have E_ALL (but I can't say right
now which bit is causing it - perhaps E_NOTIFY, I'm a beginner with error checking), then you
are only allowed to have constant names without the quotes in include files. (It's probably a
bit more subtle than that, but that's where I've got to so far). Strange.
So now, for my constants which I only want in one PHP file rather than a more global include file, I
have to write:
define("c_bilingual_yes", "Yes@@Oui");
After that, I can still *refer* to the constant without putting its name in quotes, without an error
message. Weird...
----
Manual Page -- http://www.php.net/manual/en/language.constants.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+57288
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57288&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57288&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57288&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57288&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57288&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57288&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57288&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+57288&report=yes
Search -- http://master.php.net/manage/user-notes.php