PHP constant() function
Definition and Usage
The constant() function returns the value of the constant.
Syntax
constant(constant)
Parameter | Description |
---|---|
constant | Required. Specifies the name of the constant to check. |
Tips and Comments
Note:This function is only applicable to class constants.
Example
<?php //Define a constant define("GREETING","Hello world!"); echo constant("GREETING"); ?>
Output:
Hello world!