Check if a constant exists:
<?php
define("GREETING","Hello you! How are you today?");
echo defined("GREETING");
?>
Try it Yourself »
The defined() function checks whether a constant exists.
defined(
name)
Parameter | Description |
---|---|
name | Required. Specifies the name of the constant to check |
Return Value: | Returns TRUE if the constant exists, or FALSE otherwise |
---|---|
PHP Version: | 4+ |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!