How to use php defined function

藏色散人
Release: 2023-02-22 20:18:01
Original
4123 people have browsed it

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)
Copy after login

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");
?>
Copy after login

Output:

1
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template