How do I access a constant which name was declared with a dot (eg.: SOME.CONSTANT), without using the “constant” function?
The main reason for that, is so I can declare a class property like this:
class Classname {
public $variable = SOME.CONSTANT; // Can't use "constant('SOME.CONSTANT')" here
}
And yet: any particular reason I should avoid the use of dots in constant names? I just started using it so I could create some kind of “namespace” for constants, as in AUTHCONTROL.ACCESSLEVEL.ADMIN
Thanks
It’s probably better to use
_as a namespace separator in constant names. Examples includeE_USER_ERROR,M_PIand so on.