note 55376 added to function.class-implements
| From: | ludvig dot ericson at gmail dot nospam dot com | Date: | Mon, 01 Aug 2005 19:41:55 +0000 |
| Subject: | note 55376 added to function.class-implements | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-92886@lists.php.net to get a copy of this message | ||
Hint:
<?php
in_array("your-interface", class_implements($object_or_class_name));
?>
would check if 'your-interface' is ONE of the implemented interfaces.
Note that you can use something similar to be sure the class only implements that, (whyever you
would want that?)
<?php
array("your-interface") == class_implements($object_or_class_name);
?>
I use the first technique to check if a module has the correct interface implemented, or else it
throws an exception.
----
Manual Page -- http://www.php.net/manual/en/function.class-implements.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+55376
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55376&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55376&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55376&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55376&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55376&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55376&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+55376&report=yes
Search -- http://master.php.net/manage/user-notes.php