-- Christoph Dorn <[hidden email]> wrote
(on Monday, 11 October 2010, 11:05 AM -0700):
> Regarding issue: http://framework.zend.com/issues/browse/ZF-10526 >
> What is the consensus on using is_a() instead of 'instanceof'.
> is_a() throws a deprecation notice for PHP < 5.3.
> I don't want to use instanceof as I don't think the class needs to
> be loaded just for that one check.
> Should I be using a combination of get_class() and is_subclass_of()
> to replace is_a()?
instanceof does not require that the class referenced be loaded; it
simply checks to see if the class of the object matches it. (Search for
"instanceof Zend_Config" throughout the codebase -- most cases where we
match against it, the class is never required, since it's not explicitly
Additionally, instanceof checks inheritance, and will return true when
* implements an interface (if an interface name is given as the
* matches any class in the inheritance (extends) tree
It's exactly the functionality you want to use here.
is_a(), is_subclass_of() and instanceof don't call autoload nor need
the class to exist since PHP 5.1.0
On Mon, Oct 11, 2010 at 9:13 PM, Christoph Dorn
<[hidden email]> wrote:
> On 10-10-11 11:40 AM, Matthew Weier O'Phinney wrote:
>> instanceof does not require that the class referenced be loaded; it
>> simply checks to see if the class of the object matches it. (Search for
> I'll commit a fix.