define() function is used to define constants. Once a constant is defined, it cannot be changed or undefined.
Example of defining constants:
<?php define("CONSTANT", "码农教程"); echo CONSTANT; ?>
Run
Constant names follow the same naming rules as any other PHP tag. Legal constant names begin with a letter or an underscore, followed by any letters, numbers, or underscores.
Constants are case-sensitive by default. By convention, constant identifiers are always uppercase and the value cannot be changed during script execution.
The difference between defining constants and defining variables:
PHP has a large number of built-in predefined constants, please refer to the PHP manual for details.
Original address: http://www.manongjc.com/php/php_constant.html
Related reading:
php str_pad() function completes the string to the specified length
Analysis and explanation of usage of php str_replace() string replacement function
php str_ireplace() function is case-insensitive to replace characters in a string
php str_getcsv() function parses the CSV string into an array