How to check if a defined constant exists in PHP?
First, these are not variables, but constants.
And you can check their existence by using the defined()
function :
bool defined ( string $name )
Checks whether the given constant exists and is defined.
Use defined()
function, for example:
if (defined('VAR_NAME')) {
// Something
}