note 59936 deleted from language.constants by cmb
| From: | cmb@php.net | Date: | Tue, 05 Jul 2016 12:57:32 +0000 |
| Subject: | note 59936 deleted from language.constants by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-205887@lists.php.net to get a copy of this message | ||
Note Submitter: anj at aps dot anl dot gov
----
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.