Usage environment:
You can use define to define constants in PHP, but you cannot use define in classes. In classes, the values of some attributes do not want to be modified. In this case, we need to use const to define them. constant.
Usage:
1. Member attributes modified with const are constants. In a class, const can only modify member properties.
2. It is recommended to use uppercase letters for constants. You cannot use $
3. The initial value of the constant must be given when it is declared
4. The access method of constants is the same as static, using ::, but Can only read
1. Use it outside the class class name::constant name
2. Use it inside the class self::constant name
The above introduces the use of the const keyword in PHP programs, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.