August 2003
Intermediate to advanced
1104 pages
19h 27m
English
These functions return information about objects and classes.
The get_class function (Listing 11.72) returns the name of the class for the given object. From within a class method, you may use the __CLASS__ constant to get the same value. Note that PHP always returns class names in all lowercase.
<?php
class animal
{
var $name;
}
$gus = new animal;
print("Gus is of type " . get_class($gus) . "<br>\n");
?>
|
The get_class_methods function (Listing 11.73) returns an array of the names of the methods for the given class. You may give the class name or an instance of the class.
Read now
Unlock full access