Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the use of define in php

Shulou Source: shulou.com Published: 2022-06-03 05:02:41 09月21日 Update

This article will explain in detail what is the use of define in php. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

Define means "definition", is a built-in function in PHP, the function is to define a constant, the syntax is "define (constant name, value, $case_insensitive)"; the parameter "$case_insensitive" specifies whether the constant name is size-sensitive or not if it is true.

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

Define is a built-in function in PHP that defines a constant.

The so-called constant is a quantity that cannot be changed. Once a constant is defined in PHP, it cannot be modified or undefined.

Legal constant names can only start with letters and underscores, followed by letters, numbers, or underscores of any length. You can define a constant through the define () function in PHP. The syntax of the define () function is as follows:

The define ($name,$value, $case_insensitive) parameter describes that $name is required. Specifies the name of the constant. $value is required. Specifies the value of the constant. $case_insensitive

Optional. Specifies whether the name of the constant is case sensitive.

If set to true, it is not case-sensitive. The default is false (case sensitive).

Example:

Define a case-sensitive constant:

Define a case-insensitive constant:

This is the end of this article on "what is the use of define in php". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.

Tags: Constant function size article underscore parameter name letter for uppercase lowercase more grammar good legal practical function content can be passed that is meaning Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Huawei OPPO Reno Shulou Technology Redmi