HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

PHP constant() Function

PHP Misc Reference PHP Misc Reference

Example

Return the value of a constant:

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

echo constant("GREETING");
?>

Run example »

Definition and Usage

The constant() function returns the value of a constant.

Note: This function also works with class constants.


Syntax

constant(constant)

Parameter Description
constant Required. Specifies the name of the constant to check

Technical Details

Return Value: Returns the value of a constant, or NULL if the constant is not defined
PHP Version: 4+


PHP Misc Reference PHP Misc Reference

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE