Php constants and php constants. Php constants. which define () functions of php constants are used to define constants. Once a constant is defined, it cannot be changed or undefined. Example of defining constants :? Phpdefine (CONSTA php constant, which php constants are there?
The define () function is used to define constants. Once a constant is defined, it cannot be changed or undefined.
Example of defining constants:
Run
Constant names and any other PHP labels follow the same naming rules. A valid constant name starts with a letter or underline followed by any letter, number, or underline.
Constants are case-sensitive by default, and constant identifiers are always capitalized. this value cannot be changed during script execution.
Differences between defining constants and variables:
- No dollar sign before a constant ($)
- Constants can only be defined using the define () function, but cannot be defined using the value assignment statement.
- Constants can be defined and accessed anywhere, regardless of the variable range rules.
- Once defined, a constant cannot be redefined or undefined.
- The constant value can only be a scalar.
PHP has a large number of predefined constants. For more information, see The PHP Manual.
Address: http://www.manongjc.com/php/php_constant.html
Related reading:
Php str_pad () function to populate the string with the specified length
Analysis and explanation of php str_replace () string replacement function
The php str_ireplace () function replaces characters in strings with case-insensitive characters.
The php str_getcsv () function parses the CSV string into an array.
The includefine () function is used to define constants. Once a constant is defined, it cannot be changed or undefined. Example of defining constants :? Phpdefine ("CONSTA...