is_a() vs. instanceof

From: Date: Wed, 11 Aug 2004 00:36:45 +0000
Subject: is_a() vs. instanceof
Groups: php.internals 
Request: Send a blank email to internals+get-12086@lists.php.net to get a copy of this message
I like the new $obj instanceof ClassName way of checking class / interface types, .... but this method does have one major drawback compared to the old is_a() approach: The class must be loaded in order to perform an instanceof check! Apparently is_a() has also been deprecated, so that an E_STRICT error is thrown. This means that to check types of classes and remain E_STRICT compliant I have to load & parse every class. It's not hard to imagine situations (and experience has shown this to be the case) where this limitation can lead to a lot of extra file i/o and parsing -- and also E_WARNING if the file couldn't be included, etc. Is is possible to have instanceof not require the class to be loaded? or perhaps just have is_a() not trigger an E_STRICT error? Thanks, Hans

« previous php.internals (#12086) next »