note 89615 added to function.is-subclass-of
| From: | DamienBezborodov at osu1 dot php dot net | Date: | Tue, 17 Mar 2009 00:55:32 +0000 |
| Subject: | note 89615 added to function.is-subclass-of | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-152013@lists.php.net to get a copy of this message | ||
If you need something similar to is_subclass_of() to determine if a class implements an interface
before instantiating it, use reflection:
<?php
interface A_Interface {}
class A implements A_Interface {}
$reflectionA = new ReflectionClass('A');
var_dump(
$reflectionA->implementsInterface('A_Interface')
);
?>
bool(true)
----
Server IP: 117.55.229.1
Probable Submitter: 210.10.53.49
----
Manual Page -- http://www.php.net/manual/en/function.is-subclass-of.php
Edit -- https://master.php.net/note/edit/89615
Del: integrated -- https://master.php.net/note/delete/89615/integrated
Del: useless -- https://master.php.net/note/delete/89615/useless
Del: bad code -- https://master.php.net/note/delete/89615/bad+code
Del: spam -- https://master.php.net/note/delete/89615/spam
Del: non-english -- https://master.php.net/note/delete/89615/non-english
Del: in docs -- https://master.php.net/note/delete/89615/in+docs
Del: other reasons-- https://master.php.net/note/delete/89615
Reject -- https://master.php.net/note/reject/89615
Search -- https://master.php.net/manage/user-notes.php