PHP defined()Functions
Examples
Check if a constant exists:
<?php
define("GREETING","Hello you! How are you today?");
echo defined("GREETING");
?>
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, otherwise FALSE. |
|---|---|
| PHP Version: | 4+ |
PHP Misc Reference Manual Other Extensions