note 106313 deleted from function.interface-exists by danbrown
| From: | danbrown@php.net | Date: | Thu, 27 Oct 2011 14:00:38 +0000 |
| Subject: | note 106313 deleted from function.interface-exists by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-184171@lists.php.net to get a copy of this message | ||
Note Submitter: nils dot rocine at gmail dot com
----
A little note on namespaces that may be obvious to some, but was not obvious to me.
Although you can make the below statement when the statement is in the same namespace as the
interface/class declaration MyInterface...
<?
$foo instanceof MyInterface
?>
Making use of the interface_exists, or class_exists functions, you must enter the full namespaced
interface name like so (even if the function call is from the same namespace.)
<?
interface_exists(__NAMESPACE__ . '\MyInterface', false);
?>