PHP constant() 函数

定义和用法
constant() 函数返回常量的值。
语法
constant(constant)
参数 | 描述 |
---|---|
constant | 必需。规定要检查的常量的名称。 |
提示和注释
注释:该函数仅适用于 class 常量。
例子
<?php
//定义一个常量
define("GREETING","Hello world!");
echo constant("GREETING");
?>
//定义一个常量
define("GREETING","Hello world!");
echo constant("GREETING");
?>
输出:
Hello world!
