且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何检查PHP中是否存在已定义的常量?

更新时间:2023-11-27 23:30:40

首先,这些不是变量,而是常量.

First, these are not variables, but constants.

您可以使用 defined() 函数检查它们的存在:

And you can check their existence by using the defined() function :

bool defined ( string $name )

检查给定常量是否存在并已定义.

Checks whether the given constant exists and is defined.