Current Location: Home> Function Categories> constant

constant

Return the value of a constant
Name:constant
Category:Miscellaneous
Programming Language:php
One-line Description:Returns the value of the constant.

Definition and usage

constant() function returns the value of a constant.

Note: This function can also be used for class constants.

Example

Returns the value of the constant:

 <?php
// Define a constant
define ( "GREETING" , "Hello you! How are you today?" ) ;

// Use the constant() function to get the value of a constant and output it
echo constant ( "GREETING" ) ;
?>

Try it yourself

grammar

 constant ( constant )
parameter describe
constant Required. Specifies the name of the constant to be checked.
Similar Functions
Popular Articles