Home  >  Article  >  Backend Development  >  How to use php defined function

How to use php defined function

藏色散人
藏色散人Original
2019-05-27 09:30:144126browse

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

#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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn