Const or constant is data or a value that does not change in a specified amount of time, unlike a variable. For example, in a PHP script, when a constant is defined, it remains the same throughout the script. Below is an example of how you’d define and use a constant.
define (‘EXAMPLE’, ‘There is hope!\n’);echo ‘Is there hope? ‘, EXAMPLE;
Entering the code above would return “Is there hope? There is hope!” in a PHP page.
Programming terms, Read-only, Static, Variable
It’s common and preferred that constants be created in all uppercase.
Related Pages
- How to create a computer program.