note 59936 added to language.constants
| From: | anj at aps dot anl dot gov | Date: | Tue, 20 Dec 2005 16:42:59 +0000 |
| Subject: | note 59936 added to language.constants | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-100477@lists.php.net to get a copy of this message | ||
It is possible to define constants that have the same name as a built-in PHP keyword, although
subsequent attempts to actually use these constants will cause a parse error. For example in PHP
5.1.1, this code
<?php
define("PUBLIC", "Hello, world!");
echo PUBLIC;
?>
gives the error
Parse error: syntax error, unexpected T_PUBLIC in test.php on line 3
This is a problem to be aware of when converting PHP4 applications to PHP5, since that release
introduced several new keywords that used to be legal names for constants.
----
Manual Page -- http://www.php.net/manual/en/language.constants.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+59936
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59936&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59936&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59936&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59936&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59936&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59936&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59936&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+59936&report=yes
Search -- http://master.php.net/manage/user-notes.php