What are the ways to define a constant in PHP?
PHP constants are name or identifier that can't be changed during the execution of the script. PHP constants can be defined by 2 ways:
- Using define() function
- Using const keyword
PHP constants follow the same PHP variable rules. For example, it can be started with letter or underscore only.
Conventionally, PHP constants should be defined in uppercase letters.