Constants are used to store the values that are not supposed to be changed later. They also are often used to store the configuration parameters especially those which define the environment (dev/production).
Constants have types like variables but not all types can be used to initialize a constant. Objects and resources cannot be used as values for constants at all. Arrays can be used as constants starting from PHP 5.6
Some constant names are reserved by PHP. These include true
, false
, null
as well as many module-specific constants.
Constants are usually named using uppercase letters.