Search Results
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
Jul 23, 2025 · Output: Yes, Article is subclass of GeeksforGeek Example 2: The following code demonstrates another example of the PHP is_subclass_of () method.
- Parameters
- Return Value
- Php Version
- Example 1
- Example 2
- Example 3
Below are the parameters of the is_subclass_of()function − 1. $object_or_class− It is the object instance or class name you want to check. 2. $class− It is the class name you are checking for. 3. $allow_string− It is optional. If set to true, the first parameter can be a string representing the class name. Default is true.
The is_subclass_of()function returns TRUE if the first parameter is a subclass of the given class, FALSE otherwise.
First introduced in core PHP 4, the is_subclass_of()function continues to function easily in PHP 5, PHP 7, and PHP 8.
This example shows how to use the PHP Class/Object is_subclass_of()function to check if one class is a subclass of another class.
In the below PHP code we will use the is_subclass_of()function and check if a class (Blog) implements an interface (WebsiteInterface). So it also checks for an unrelated interface.
This example explains how to use the is_subclass_of()function to see if one class (wid_fact_child) is a subclass of another (wid_fact). It also shows how to evaluate the relationship in both the child and parent groups.
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
« is_a method_exists » PHP Manual Classes/Object Functions Checks if the object has this class as one of its parents or implements it
is_subclass_of 21 nov. 2018 32 fois (PHP 4, PHP 5, PHP 7, PHP 8) is_subclass_of — Détermine si un objet est une sous-classe d'une classe donnée ou l'implémente
Return Values This function returns TRUE if the object object , belongs to a class which is a subclass of class_name , FALSE otherwise.
