September 2001
Intermediate to advanced
768 pages
32h 45m
English
bool defined(string constant_name) Checks whether a constant is defined.
Returns:
TRUE if the constant is defined; FALSE otherwise
Description:
defined() is used to check whether the constant named in the constant_name argument is defined.
If the constant is defined, the function returns TRUE. If the constant is not defined, the function returns FALSE.
Availability:
UNIX/Linux, Windows
Version:
3+, 4+
See also:
To define a constant:
define()
To check whether a class is defined:
class_exists()
To check whether a function is defined:
function_exists()
To check whether a variable is defined:
isset()
Example:
$constant_name = 'FOO'; if (defined ($constant_name)) echo "Constant <i>$constant_name</i> ... |
Read now
Unlock full access