the define() function defines a constant.
define()函数的作用是:定义一个常量。
constants are much like variables, except for the following differences:
常量[constant]与变量[variable]有很多相似的地方,因此,很容易混淆;下面,我们列举一下常量[constant]与变量[variable]之间的不同点:
•a constant's value cannot be changed after it is set
一个常量值在指定之后就不可以更改;
•constant names do not need a leading dollar sign ($)
设置常量时,不需要在前面加上“$”符号;
•constants can be accessed regardless of scope
常量可以被所有范围的域访问;
•constant values can only be strings and numbers
常量的值只能是“字符串[string]”和“数字[number]”;
syntax
语法
parameter 参数 |
description 描述 |
---|---|
name | required. specifies the name of the constant 必要参数。指定常量的名称 |
value | required. specifies the value of the constant 必要参数。指定常量的值 |
case_insensitive | optional. specifies whether the constant name should be case-insensitive. if set to true, the constant will be case-insensitive. default is false (case-sensitive) 可选参数。指定常量的名称是否是不区分大小写的[case-insensitive]。如果设置为true,则不区分字母大小写;如果设置为false,则区分字母大小写。默认值是:false |
example 1
案例1
define a case-sensitive constant:
指定一个常量(区分大小写):
returns true if the constant exists, or false otherwise.
如果该常量存在,则返回true;如果不存在,则返回false。
syntax
语法
parameter 参数 |
description 描述 |
---|---|
name | required. specifies the name of the constant to check 必要参数。指定常量对象的名称 |
example
案例
如对本文有疑问, 点击进行留言回复!!
[ACTF2020 新生赛]Include 1【文件包含】【读取代码】
算法题解 - 牛客编程巅峰赛S1第6场 - 黄金&钻石&王者组
推荐一个程序员必备网站之一:Dev Hints ,非常实用!
网友评论