PHP constant() 函數
實例
返回一個常量的值:
<?php
//define a constant
define("GREETING","Hello you! How are you today?");
echo constant("GREETING");
?>
//define a constant
define("GREETING","Hello you! How are you today?");
echo constant("GREETING");
?>
定義和用法
constant() 函數返回一個常量的值。
注釋: 該函數也適用於 class 常量。
語法
constant(constant)
參數 | 描述 |
---|---|
constant | 必需。規定要檢查的常量的名稱。 |
技術細節
返回值: | 返回常量的值,如果常量未定義則返回 NULL。 |
---|---|
PHP 版本: | 4+ |
