Home>Article>Backend Development> How to use define modification function in php?

How to use define modification function in php?

coldplay.xixi
coldplay.xixi Original
2020-07-11 15:52:29 3225browse

Usage of define modification function in php: 1. After setting, the value of the constant cannot be changed; 2. The constant name does not need the dollar sign [$] at the beginning; 3. The scope does not affect the use of the constant Access; 4. Constant values can only be strings or numbers.

How to use define modification function in php?

definemodify the use offunction in php:

Definition and usage

#define()The function defines a constant.

Constants are similar to variables, the difference is:

  • After setting, the value of the constant cannot be changed

  • Constant The name does not need to start with a dollar sign ($)

  • The scope does not affect access to constants

  • The constant value can only be a string or Number

Syntax

define(name,value,case_insensitive)

How to use define modification function in php?

##Example 1

Define a case-sensitive Constant:

Output:

Hello world!

Example 2

Define a case-insensitive constant:

Output:

Hello world!

Related learning recommendations:

PHP programming from entry to proficiency

The above is the detailed content of How to use define modification function in php?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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