constant name
| From: | Mehdi Achour | Date: | Wed, 05 May 2004 20:01:54 +0000 |
| Subject: | constant name | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-9673@lists.php.net to get a copy of this message | ||
Hi !
The manual reads :
"The name of a constant follows the same rules as any label in PHP. A
valid constant name starts with a letter or underscore, followed
by any number of letters, numbers, or underscores. As a regular
expression, it would be expressed thusly:
'[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]'"
I know that this is true when trying to echo a constant directly, as the parser raise an error, but you can trick it with a constant() call :
<?php
define('
(\ /)
{°_°)
() ()
( )( )
', 'barfoo');
echo constant('
(\ /)
{°_°)
() ()
( )( )
') . chr(10); // outputs : bar
Is it a feature or a bug ? :)
Mehdi Achour