note 76542 added to language.constants
| From: | Sinured at osu1 dot php dot net | Date: | Thu, 19 Jul 2007 19:27:27 +0000 |
| Subject: | note 76542 added to language.constants | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-128744@lists.php.net to get a copy of this message | ||
> "A valid constant name starts with a letter or underscore, followed by any number of
> letters, numbers, or underscores."
This rules only applies when using constants like <?php echo CONSTANT;?> to not confuse the
parser - PHP will be happy with any string for a constant name (define).
<?php
define('Red herring!', '<°)))><');
#echo Red herring!;
// The above example will not work, the parser will get
// angry seeing a whitespace where it shouldnât be.
// Letâs have that with constant():
echo constant('Red herring!'); // <°)))><
?>
You could go on with newlines, tabs and stuff... that is, however, crude coding style.
----
Server IP: 212.124.37.9
Probable Submitter: 172.176.86.4
----
Manual Page -- http://www.php.net/manual/en/language.constants.php
Edit -- https://master.php.net/note/edit/76542
Del: integrated -- https://master.php.net/note/delete/76542/integrated
Del: useless -- https://master.php.net/note/delete/76542/useless
Del: bad code -- https://master.php.net/note/delete/76542/bad+code
Del: spam -- https://master.php.net/note/delete/76542/spam
Del: non-english -- https://master.php.net/note/delete/76542/non-english
Del: in docs -- https://master.php.net/note/delete/76542/in+docs
Del: other reasons-- https://master.php.net/note/delete/76542
Reject -- https://master.php.net/note/reject/76542
Search -- https://master.php.net/manage/user-notes.php