note 106314 modified in function.interface-exists by danbrown

From: Date: Thu, 27 Oct 2011 14:03:07 +0000
Subject: note 106314 modified in function.interface-exists by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-184175@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... <?php $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.) <?php interface_exists(__NAMESPACE__ . '\MyInterface', false); ?> --was-- 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); ?> http://php.net/manual/en/function.interface-exists.php

« previous php.notes (#184175) next »