-
Notifications
You must be signed in to change notification settings - Fork 735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Constant Name Regular Expression Note #2772
Comments
The note sounds weird to me, and is out of place given it's related to the "The name of a constant..." sentence a couple paragraphs up, but what it is trying to say is correct: the bytes 0x80-0xFF are allowed. Because PHP doesn't really care about character encoding in source files: accented characters, emoji, whatever, it's the actual bytes that matter and affect validity. And the precise range of what "ASCII" covers probably depends on the person: it's mostly 0-127, sure, but 128-255 is part of the "extended" range so they kinda count too. I think the source of confusion here is going to be mostly around the use of the term "characters". That should be dropped entirely and the unambiguous term "bytes" used instead. But my choice would be to remove this note entirely and rephrase the earlier paragraph to something along the lines of
Perhaps something even more than that which calls out PHP's encoding-agnosticism? Additionally, the Variables > Basics page and user-defined functions page repeat similar statements. May be another page or two I'm not thinking of too. |
You might want to add to your paragraph that this means emojis and accented characters work as well, in case this is not clear enough. |
Can we please not tell people that emoji are supported in names? |
I think it is something that most would agree is not advisable, dont get me wrong. It still might be good to know to understand the concept. |
From manual page: https://php.net/language.constants
I think the note concerning the possible names of constants is incorrect.
As fair as my knowledge goes, the x80-xFF is not ASCII/UTF code points, but applies to any bytes from 10000000 to 11111111. AT least that is how it works with variables and other names. I also tested it and emojis as names work fine.
The text was updated successfully, but these errors were encountered: