Latest web development tutorials

PHP defined () function

PHP Misc Reference Manual PHP Misc Reference Manual

Examples

Check whether a constant presence:

<?php
define("GREETING","Hello you! How are you today?");
echo defined("GREETING");
?>

Running instance »

Definition and Usage

defined () function checks whether a constant presence.


grammar

defined( name )

参数 描述
name 必需。规定要检查的常量的名称。

technical details

return value: If the constant exists, it returns TRUE, otherwise returns FALSE.
PHP version: 4+


PHP Misc Reference Manual PHP Misc Reference Manual