Re: Re: constant name

From: Date: Sun, 09 May 2004 16:14:55 +0000
Subject: Re: Re: constant name
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-9766@lists.php.net to get a copy of this message
No, you should say that only [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]* are valid. In addition, maybe post 5.0 we will unify global const and class const and then it'll definitely not work with those weird names. There are also plenty of weird things you can do with C which aren't defined. Andi At 11:20 AM 5/7/2004 +0200, Mehdi Achour wrote:
Derick Rethans wrote:
On Fri, 7 May 2004, Mehdi Achour wrote:
Should I change the documentation to say that ".*" can be a constant name, but that we recommand [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]* ?
Just leave it as is.
I wanted to complete the TODO commented on languages/constants.xml (Example of valid & invalid constant names) But anyway...
Derick
Mehdi Achour wrote:
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
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.internals (#9766) next »