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+ |
PHP Misc參考手冊