Home >Backend Development >PHP Problem >How to use php defined function
php defined function is used to check whether a certain constant exists. Its syntax is defined(name). The parameter name is required and refers to the name of the constant to be checked.
#How to use php defined function?
Definition and usage
defined() function checks whether a constant exists.
Syntax
defined(name)
Parameters
name Required. Specifies the name of the constant to be checked.
Return value: TRUE if the constant exists, otherwise FALSE.
PHP Version: 4
Example
Check whether a constant exists:
<?php define("GREETING","Hello you! How are you today?"); echo defined("GREETING"); ?>
Output:
1
The above is the detailed content of How to use php defined function. For more information, please follow other related articles on the PHP Chinese website!