PHP定数()関数
例
定数の値を返します。
<?php
//define a constant
define("GREETING","Hello you! How are you today?");
echo constant("GREETING");
?>
定義と使用法
constant()関数は、定数の値を返します。
注: この関数は、クラス定数でも機能します。
構文
constant(constant)
パラメータ値
Parameter | Description |
---|---|
constant | Required. Specifies the name of the constant to check |
技術的な詳細
戻り値: | 定数の値を返します。定数が定義されていない場合はNULLを返します |
---|---|
PHPバージョン: | 4歳以上 |
❮PHPその他のリファレンス