note 106313 added to function.interface-exists
| From: | nils dot rocine at gmail dot com | Date: | Thu, 27 Oct 2011 01:34:05 +0000 |
| Subject: | note 106313 added to function.interface-exists | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-184157@lists.php.net to get a copy of this message | ||
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);
?>
----
Server IP: 64.71.164.2
Probable Submitter: 216.55.28.118
----
Manual Page -- http://www.php.net/manual/en/function.interface-exists.php
Edit -- https://master.php.net/note/edit/106313
Del: integrated -- https://master.php.net/note/delete/106313/integrated
Del: useless -- https://master.php.net/note/delete/106313/useless
Del: bad code -- https://master.php.net/note/delete/106313/bad+code
Del: spam -- https://master.php.net/note/delete/106313/spam
Del: non-english -- https://master.php.net/note/delete/106313/non-english
Del: in docs -- https://master.php.net/note/delete/106313/in+docs
Del: other reasons-- https://master.php.net/note/delete/106313
Reject -- https://master.php.net/note/reject/106313
Search -- https://master.php.net/manage/user-notes.php