# See if a class is a subclass of other?

- Thread: https://externals.io/message/13465
- Original archive: https://news-web.php.net/php.internals/13465
- Started by Francisco M. Marzoa Alonso on 2004-10-22T14:15:26+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #13465 — Francisco M. Marzoa Alonso — 2004-10-22T14:15:26+00:00

URL: https://externals.io/message/13465#13465

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

---

## #13466 — Andrey Hristov — 2004-10-22T14:19:30+00:00

URL: https://externals.io/message/13465#13466 · In reply to: #13465

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
