# class_implements()/class_parents() accepting string parameter

- Thread: https://externals.io/message/15863
- Original archive: https://news-web.php.net/php.internals/15863
- Started by Lukas Smith on 2005-04-06T13:46:08+00:00
- Messages: 4
- 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

---

## #15863 — Lukas Smith — 2005-04-06T13:46:08+00:00

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

Hi,

it would be very useful if `class_implements()`/class_parents() would also 
handle a string containing a class name instead of requiring an object 
instance.

regards,
Lukas

---

## #15864 — Marcus Boerger — 2005-04-06T13:54:44+00:00

URL: https://externals.io/message/15863#15864 · In reply to: #15863

Hello Lukas,

Wednesday, April 6, 2005, 3:46:08 PM, you wrote:

> Hi,

> it would be very useful if `class_implements()`/class_parents() would also 
> handle a string containing a class name instead of requiring an object 
> instance.

Class as it says does not need an instance. Can you send a patch?


-- 
Best regards,
 Marcus                            mailto:mail@marcus-boerger.de

---

## #15869 — Andrey Hristov — 2005-04-06T14:25:57+00:00

URL: https://externals.io/message/15863#15869 · In reply to: #15864

Marcus Boerger wrote:
> Hello Lukas,
> 
> Wednesday, April 6, 2005, 3:46:08 PM, you wrote:
> 
> 
> > […]
> 
> 
> > […]
> 
> 
> Class as it says does not need an instance. Can you send a patch?
> 
> 
  Hello Marcus, Lucas,
I have made a patch for `class_implements()` :

http://andrey.hristov.com/projects/php_stuff/patches/class_implements.patch.txt
The function is here :
http://andrey.hristov.com/projects/php_stuff/patches/class_implements.c

Andrey

---

## #15870 — Andrey Hristov — 2005-04-06T14:29:12+00:00

URL: https://externals.io/message/15863#15870 · In reply to: #15869

Andrey Hristov wrote:
> Marcus Boerger wrote:
> 
> > […]
>  Hello Marcus, Lucas,
> I have made a patch for `class_implements()` :
> 
> http://andrey.hristov.com/projects/php_stuff/patches/class_implements.patch.txt 
> 
> The function is here :
> http://andrey.hristov.com/projects/php_stuff/patches/class_implements.c
> 
> Andrey
> 

and this is the test script :
./php -r 'interface iface1{}interface iface2{} class a implements iface1, iface2{} 
var_dump(class_implements(new a), class_implements("a"), class_implements("aaa"), 
class_implements("bbb", 0)); function __autoload($cname){ var_dump($cname);}'

or

<?php
interface iface1{}
interface iface2{}
class a implements iface1, iface2{}
var_dump(class_implements(new a),
          class_implements("a"),
          class_implements("aaa"),
          class_implements("bbb", 0)
);

function __autoload($cname){
     var_dump($cname);
}
?
