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