Re: class_implements()/class_parents() accepting string parameter

From: Date: Wed, 06 Apr 2005 14:29:12 +0000
Subject: Re: class_implements()/class_parents() accepting string parameter
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-15870@lists.php.net to get a copy of this message
Andrey Hristov wrote:
Marcus Boerger wrote:
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?
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);
} ?>

« previous php.internals (#15870) next »