PHP constant() 函數(shù)
定義和用法
constant() 函數(shù)返回常量的值。
語法
constant(constant)
參數(shù) | 描述 |
---|---|
constant | 必需。規(guī)定要檢查的常量的名稱。 |
提示和注釋
注釋:該函數(shù)僅適用于 class 常量。
例子
<?php
//定義一個常量
define("GREETING","Hello world!");
echo constant("GREETING")
;
?>
輸出:
Hello world!