PHP Const: Complete Guide
In PHP, the const function is used to define constants. Constants are values that cannot be changed, typically used to store values or strings that won’t be altered. Once a constant is defined, it cannot be modified or reassigned. Constants are globally available throughout the entire script and can be accessed by any function or code snippet.
Constants are defined using the const keyword, typically written in all uppercase letters, for example: const MY_CONSTANT = ‘value’; The value of a constant can be any valid PHP expression, but once defined, it cannot be changed. In the code, constants can be accessed and used by simply using the constant name.