PHP constant () function
Examples
The return value is a 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");
?>
Running instance »
Definition and Usage
() Function returns a constant value constant.
Note: This function is also applicable to class constants.
grammar
constant( constant )
参数 | 描述 |
---|---|
constant | 必需。规定要检查的常量的名称。 |
technical details
return value: | Returns the value of the constant, if the constant is not defined returns NULL. |
---|---|
PHP version: | 4+ |
PHP Misc Reference Manual