當前位置: 首頁> 函數類別大全> constant

constant

返回常量的值
名稱:constant
分類:雜項
所屬語言:php
一句話介紹:返回常量的值。

定義和用法

constant()函數返回常量的值。

注意:這個函數也可以用於類常量。

實例

返回常量的值:

 <?php
// 定義一個常量
define ( "GREETING" , "Hello you! How are you today?" ) ;

// 使用constant() 函數獲取常量的值並輸出
echo constant ( "GREETING" ) ;
?>

親自試一試

文法

constant ( constant )
參數描述
constant必需。規定要檢查的常量的名稱。
同類函數
  • 返回刪除註釋和空格後的PHP源碼 php_strip_whitespace

    php_strip_whitespace

    返回刪除註釋和空格後的PHP源碼
  • highlight_file的別名 show_source

    show_source

    highlight_file的別名
  • 獲取系統的高精度時間 hrtime

    hrtime

    獲取系統的高精度時間
  • 中斷編譯器的執行 __halt_compiler

    __halt_compiler

    中斷編譯器的執行
  • 定義一個常量 define

    define

    定義一個常量
  • 語法高亮一個文件 highlight_file

    highlight_file

    語法高亮一個文件
  • 以指定的微秒數延遲執行 usleep

    usleep

    以指定的微秒數延遲執行
  • 輸出一個消息並且退出當前腳本 exit

    exit

    輸出一個消息並且退出當前腳本
熱門文章