As we all know, constants
are the same as <span style="font-family:monospace">variables</span>
, both are used to save data.
1. The basic concept of constants
const/constant: It is an unchangeable quantity (data) during the running of the program;
final modifier. (About the final modifier "
Final's Journey in this Life")
2. The form of constant definition
a. Use the function that defines the constant :define ('constant name', constant value)
<?php define('A',10); echo A; ?>
constKeyword
<?php const A=10; echo A; ?>
3. Naming of constants Rules
php tutorial,php video tutorial
The above is the detailed content of How to define constants in php?. For more information, please follow other related articles on the PHP Chinese website!