PHP defined() Function
Example
Check if a constant exists:
<?php
define("GREETING","Hello you! How are you today?");
echo defined("GREETING");
?>
Run example »
Definition and Usage
The defined() function checks whether a constant exists.
Syntax
defined(name)
Parameter | Description |
---|---|
name | Required. Specifies the name of the constant to check |
Technical Details
Return Value: | Returns TRUE if the constant exists, or FALSE otherwise |
---|---|
PHP Version: | 4+ |
PHP Misc Reference