is_subclass_of

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
Manual
Code Examples

Example #1 is_subclass_of example

Result: yes, $WFC is a subclass of WidgetFactory no, $WF is not a subclass of WidgetFactory yes, WidgetFactory_Child is a subclass of WidgetFactory
PHP Version:

Example #2 is_subclass_of using interface example

Result: Yes, $my_object is a subclass of MyInterface Yes, MyClass is a subclass of MyInterface
PHP Version:


Function is_subclass_of:

Class/Object Information Functions

Most used PHP functions