| class_exists($s) |
returns true if the class $s has been defined. |
| interface_exists($s) |
returns true if the interfacce $s has been defined. |
| trait_exists ($s) |
returns true if the trait $s has been defined. |
| method_exists($m,$s) |
returns true if the method $s has been defined. $m is an object instance or the class name. |
| property_exists($m,$s) |
returns true if the property $s has been defined. $m is an object instance or the class name. |
| |
|
| get_declared_classes() |
returns an array with the names of the defined classes. |
| get_declared_ interfaces() |
returns an array with the names of the declared interfaces. |
| get_declared_traits() |
returns an array of all declared traits. |
| get_class($o) |
returns the class name of $o as a string. |
| is_a($o,$s[,$b=FALSE]) |
returns true if $o belongs to the class $s or has this class as its ancestor. If $b is false, a string class name for $o is not allowed. |
| is_subclass_of($m,$s[,$b=TRUE]) |
returns true if a class or object $m has the class $s as its ancestor. If $b is false, a string class name for $o is not allowed. |
| get_parent_class($m) |
returns the parent class name for the object or class $m. |
<!DOCTYPE html><html><head></head>
<body><?php
class P {public $a=0;}
class C extends P{private $b=0;}
$o = new C;
var_dump(class_exists('C'));
var_dump(property_exists($o,'b'));
var_dump(property_exists('C','a'));
echo "<br />";
echo get_class($o)."<br />";
echo is_a($o,'P')."<br />";
echo is_subclass_of($o,'P')."<br />";
echo get_parent_class($o)."<br />";
echo get_parent_class('C')."<br />";
print_r(get_declared_interfaces());
?></body></html>
<!DOCTYPE html><html><head></head>
<body><?php
class P {public $a=0;}
class C extends P{private $b=0;}
$o = new C;
var_dump(class_exists('C'));
var_dump(property_exists($o,'b'));
var_dump(property_exists('C','a'));
echo "<br />";
echo get_class($o)."<br />";
echo is_a($o,'P')."<br />";
echo is_subclass_of($o,'P')."<br />";
echo get_parent_class($o)."<br />";
echo get_parent_class('C')."<br />";
print_r(get_declared_interfaces());
?></body></html>
bool(true) bool(true) bool(true)
C
1
1
P
P
Array ( [0] => Traversable [1] => IteratorAggregate [2] => Iterator [3] => ArrayAccess [4] => Serializable [5] => JsonSerializable [6] => RecursiveIterator [7] => OuterIterator [8] => Countable [9] => SeekableIterator [10] => SplObserver [11] => SplSubject [12] => Reflector [13] => SessionHandlerInterface )