PHP 4, PHP 5, PHP 7, PHP 8
is_subclass_of - Checks if the object has this class as one of its parents or implements it
is_subclass_of( mixed$object_or_class, string$class, [bool$allow_string = true] ): bool
Checks if the given object_or_class has the class class as one of its parents or implements it.
A class name or an object instance. No error is generated if the class does not exist.
The class name
If this parameter set to false, string class name as object_or_class is not allowed. This also prevents from calling autoloader if the class doesn't exist.
This function returns true if the object object_or_class, belongs to a class which is a subclass of class, false otherwise.
Using this function will use any registered autoloaders if the class is not already known.
Show all examples for is_subclass_of