Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:12086 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 55278 invoked by uid 1010); 11 Aug 2004 00:36:57 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 55246 invoked from network); 11 Aug 2004 00:36:57 -0000 Received: from unknown (HELO lakermmtao07.cox.net) (68.230.240.32) by pb1.pair.com with SMTP; 11 Aug 2004 00:36:57 -0000 Received: from [192.168.3.100] (really [68.98.128.109]) by lakermmtao07.cox.net (InterMail vM.6.01.03.02.01 201-2131-111-104-103-20040709) with ESMTP id <20040811003657.JCRI5847.lakermmtao07.cox.net@[192.168.3.100]> for ; Tue, 10 Aug 2004 20:36:57 -0400 Message-ID: <41196A1D.6060808@velum.net> Date: Tue, 10 Aug 2004 20:36:45 -0400 User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: is_a() vs. instanceof From: hans@velum.net (Hans Lellelid) 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