Return the value of a constant:
<?php
//define a constant
define("GREETING","Hello you! How are you today?");
echo constant("GREETING");
?>
Try it Yourself »
The constant() function returns the value of a constant.
Note: This function also works with class constants.
constant(
constant)
Parameter | Description |
---|---|
constant | Required. Specifies the name of the constant to check |
Return Value: | Returns the value of a constant, or NULL if the constant is not defined |
---|---|
PHP Version: | 4+ |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!