Home > Backend Development > PHP Problem > What does define in php mean?

What does define in php mean?

青灯夜游
Release: 2023-03-13 09:00:01
Original
2456 people have browsed it

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.

What does define in php mean?

The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer

What does define in php mean?

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)
Copy after login
ParametersDescription
$nameRequired. Specifies the name of the constant.
$valueRequired. 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");
?>
Copy after login

Output result:

What does define in php mean?

Define a case-insensitive constant:

<?php
header("Content-type:text/html;charset=utf-8");
define("WebSite","PHP中文网",TRUE);
echo constant("website");
?>
Copy after login

Output result:

What does define in php mean?

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template