is there a historical reason or some other kind of reason for this not to work?
class AClass {
const CONST = 2;
}
echo AClass::CONST;
I get a parse error:
Parse error: syntax error, unexpected 'CONST' (T_CONST)
Just curiosity.
PHP keywords are case-insensitive, so it can't tell the difference between const CONST and const const. When it parses that code it sees the same keyword twice, which is not the right syntax, and so it gets upset.
const. E.g., const CLASS = 2; will cause the same complaint.Not sure of any historical reason, but why would you want to name a constant CONST? It's the same as naming a variable $var.
You should be aiming to make sure that constant and variable names actually mean something. When you look at the code a year down the line will you know what the CONST constant is meant to mean?