# [PATCH] is_subclass_of(mixed, string)

- Thread: https://externals.io/message/13489
- Original archive: https://news-web.php.net/php.internals/13489
- Started by Andrey Hristov on 2004-10-24T13:07:09+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #13489 — Andrey Hristov — 2004-10-24T13:07:09+00:00

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

Hi,
I have cooked a small patch which allows `is_subclass_of()` the accept
not only an object as first parameter but a string as well. When string
is passed the function checks whether the class specified is subclass of
the second parameter
class a{}
class b{} extends a{}
is_subclass_of("a", "a") //false
is_subclass_of("b", "a") //true
currently only objects are allowed as first parameter

The patch can be seen here :
http://www.hristov.com/andrey/projects/php_stuff/patches/is_subclass_of.patch.txt
The phpt file is :
http://www.hristov.com/andrey/projects/php_stuff/patches/is_subclass_of.phpt

Thanks,
Andrey

---

## #13493 — Andi Gutmans — 2004-10-25T00:23:21+00:00

URL: https://externals.io/message/13489#13493 · In reply to: #13489

This patch looks fine to me.
Any objections before I commit it?

Andi
At 03:07 PM 10/24/2004 +0200, Andrey Hristov wrote:
>  Hi,
>I have cooked a small patch which allows `is_subclass_of()` the accept
>not only an object as first parameter but a string as well. When string
>is passed the function checks whether the class specified is subclass of
>the second parameter
>class a{}
>class b{} extends a{}
>is_subclass_of("a", "a") //false
>is_subclass_of("b", "a") //true
>currently only objects are allowed as first parameter
>
>The patch can be seen here :
>http://www.hristov.com/andrey/projects/php_stuff/patches/is_subclass_of.patch.txt
>The phpt file is :
>http://www.hristov.com/andrey/projects/php_stuff/patches/is_subclass_of.phpt
>
>Thanks,
>Andrey

---

## #13547 — Andi Gutmans — 2004-10-26T23:25:43+00:00

URL: https://externals.io/message/13489#13547 · In reply to: #13489

Applied. Can you please update PHP 5.0 NEWS?

Thanks,
Andi

At 03:07 PM 10/24/2004 +0200, Andrey Hristov wrote:
>  Hi,
>I have cooked a small patch which allows `is_subclass_of()` the accept
>not only an object as first parameter but a string as well. When string
>is passed the function checks whether the class specified is subclass of
>the second parameter
>class a{}
>class b{} extends a{}
>is_subclass_of("a", "a") //false
>is_subclass_of("b", "a") //true
>currently only objects are allowed as first parameter
>
>The patch can be seen here :
>http://www.hristov.com/andrey/projects/php_stuff/patches/is_subclass_of.patch.txt
>The phpt file is :
>http://www.hristov.com/andrey/projects/php_stuff/patches/is_subclass_of.phpt
>
>Thanks,
>Andrey
