September 2001
Intermediate to advanced
768 pages
32h 45m
English
bool class_exists(string class_name) Tests whether a class is defined.
Returns:
TRUE if the class exists; FALSE for all other cases
Description:
class_exists() is used to check whether the class class_name has been defined. If the class has been defined, the function returns TRUE; otherwise, it returns FALSE.
Availability:
UNIX, Windows
Version:
4.0b4+
See also:
To find the type of a variable:
gettype()
To find out whether a variable is an object:
is_object()
Example:
// Why no class can be a nihilist
class nihilist {
function nihilist () {
print ""; // Ha ha - sorry for the crummy nihilist humor...
}
}
if (class_exists ('nihilist'))
print "Class <i>nihilist</i> exists.";
|
Read now
Unlock full access