See if a class is a subclass of other?

php.internals

Francisco M. Marzoa Alonso

21 years ago
Is there any manner to know if a class is a subclass of another from class name as string? I meant something in the line of is_subclass_of but using the name of the child class instead of an object instance. TIA

Andrey Hristov

21 years ago
Francisco M. Marzoa Alonso wrote:
> Is there any manner to know if a class is a subclass of another from > class name as string? > > I meant something in the line of is_subclass_of but using the name of > the child class instead of an object instance. > > TIA >
In such situations I have used get_parent_class() in a loop. You may write a function for you that provides the behaviour you need and uses get_parent_class(). HTH, Andrey