Constants are more likely to be used as identifiers since their values CAN NOT change. The magic constants are a bit different in that sense.
Constant identifiers are case-sensitive but they are always defined in uppercase.
Before PHP 8, that wasn’t the case. If you had used define() function to define constants, they might not be case-sensitive!
The scope of a constant is global.
Rules to define a constant
Constant names are like any other variable names.
A valid constant name would start with a letter or underscore and you can add as many numbers, letters, underscores you want.
This is how you can define constants:
define("SITE", "yogeshchauhan.com"); define("BLOG", "yogeshchauhan.com");
You CAN NOT start a constant name with a number:
//NOT VALID define("1SITE", "yogeshchauhan.com"); define("2BLOG", "yogeshchauhan.com");
This is valid but not recommended:
//NOT VALID define("__SITE__", "yogeshchauhan.com"); define("__BLOG__", "yogeshchauhan.com");
PHP has magic constants and if in future they use the same name to add magic constant then that might break your code.
constant definition variables