How to use define modification function in php?

coldplay.xixi
Release: 2023-03-02 12:36:01
Original
3116 people have browsed it

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 of function 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)
Copy after login

How to use define modification function in php?

##Example 1

Define a case-sensitive Constant:

Copy after login

Output:

Hello world!
Copy after login
Copy after login

Example 2

Define a case-insensitive constant:

Copy after login

Output:

Hello world!
Copy after login
Copy after login
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!

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!