PHP constant() 函式
示例
返回常量的數值
<?php
// 定義一個常量
define("GREETING","Hello you! How are you today?");
echo constant("GREETING");
?>
自己動手試一試 »
定義和用法
constant() 函式返回一個常量的數值。
注意: 此函式也適用於類常量。
語法
constant(constant)
引數值
引數 | 描述 |
---|---|
constant | 必需。指定要檢查的常量的名稱 |
技術詳情
返回值 | 返回常量的值,如果常量未定義則返回 NULL |
---|---|
PHP 版本 | 4+ |
❮ PHP Misc 參考文獻