PHP constant() 函數(shù)
PHP Misc 參考手冊(cè)
實(shí)例
返回一個(gè)常量的值:
<?php
//define a constant
define("GREETING","Hello you! How are you today?");
echo constant("GREETING");
?>
運(yùn)行實(shí)例 ?
定義和用法
constant() 函數(shù)返回一個(gè)常量的值。
注釋?zhuān)?/strong> 該函數(shù)也適用于 class 常量。
語(yǔ)法
參數(shù) | 描述 |
constant | 必需。規(guī)定要檢查的常量的名稱(chēng)。 |
技術(shù)細(xì)節(jié)
返回值: | 返回常量的值,如果常量未定義則返回 NULL。 |
PHP 版本: | 4+ |
PHP Misc 參考手冊(cè)