How to use define() function in php

How to use define() function in php: define() function is used to define a constant, syntax: [define(name, value, case_insensitive)]. For example: [define("GREETING","Hello world!")].
Function: The
define() function is used to define a constant.
Syntax:
define(name,value,case_insensitive)
parameter introduction:

name is required. Specifies the name of the constant.

value is required. Specifies the value of the constant.

case_insensitive is 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).

(Related recommendation: php training)
Example:
Define a case-sensitive constant:

<?php define("GREETING","Hello world!"); echo constant("GREETING"); ?>

Output:
Hello world!
Define a case-insensitive constant:

<?php define("GREETING","Hello world!",TRUE); echo constant("greeting"); ?>

Output:
Hello world!

Guess you like

Origin blog.csdn.net/whm156399/article/details/108537845