Home >Backend Development >PHP Problem >What does define in php mean?
define means "define" and is a built-in function in PHP. Its function is to define a constant. The syntax is "define(constant name, value, $case_insensitive)"; the parameter "$case_insensitive" specifies the constant. Whether the name is size-sensitive, if true, it will not be distinguished.
The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
define is a built-in function in PHP used to define a constant.
The so-called constant is a quantity that cannot be changed. Once a constant in PHP is defined, it cannot be modified or undefined.
Legal constant names can only start with letters and underscores, and can be followed by letters, numbers, or underscores of any length. In PHP, you can define a constant through the define() function. The syntax of the define() function is as follows:
define($name,$value , $case_insensitive)
Parameters | Description |
---|---|
$name | Required. Specifies the name of the constant. |
$value | Required. Specifies the value of the constant. |
$case_insensitive |
Optional. Specifies whether constant names are case-sensitive. If set to true, it will not be case sensitive. Default is false (case sensitive). |
Example:
Define a case-sensitive constant:
<?php header("Content-type:text/html;charset=utf-8"); define("WebSite","PHP中文网"); echo constant("WebSite"); ?>
Output result:
Define a case-insensitive constant:
<?php header("Content-type:text/html;charset=utf-8"); define("WebSite","PHP中文网",TRUE); echo constant("website"); ?>
Output result:
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of What does define in php mean?. For more information, please follow other related articles on the PHP Chinese website!