Constants
Explore PHP constants and their use as immutable variables that remain unchanged during script execution. Learn to define constants using const and define, check for their existence, access reserved names, and retrieve all defined constants to write reliable PHP code.
We'll cover the following...
We'll cover the following...
Defining Constants
Constants, by definition, are variables that cannot be modified during the execution of the script. They are created using the const statement or the define function.
Convention: In PHP, the convention is to use uppercase letters for constant names, e.g.,
A_CONSTANT.
The following code snippet shows how constants are created: ...
If you ...