Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:12098 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 124 invoked by uid 1010); 12 Aug 2004 03:19:56 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 99995 invoked from network); 12 Aug 2004 03:19:56 -0000 Received: from unknown (HELO lakermmtao05.cox.net) (68.230.240.34) by pb1.pair.com with SMTP; 12 Aug 2004 03:19:56 -0000 Received: from atoihome.site ([68.102.33.167]) by lakermmtao05.cox.net (InterMail vM.6.01.03.02.01 201-2131-111-104-103-20040709) with ESMTP id <20040812031957.UYIY28993.lakermmtao05.cox.net@atoihome.site> for ; Wed, 11 Aug 2004 23:19:57 -0400 Organization: n/a To: internals@lists.php.net Date: Wed, 11 Aug 2004 22:19:55 -0500 User-Agent: KMail/1.6.2 References: <41196A1D.6060808@velum.net> In-Reply-To: <41196A1D.6060808@velum.net> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-ID: <200408112219.55268.dan@ostrowski.cc> Subject: Re: [PHP-DEV] is_a() vs. instanceof From: dan@ostrowski.cc (Dan Ostrowski) On Tuesday 10 August 2004 7:36 pm, Hans Lellelid wrote: > 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! > Isn't that the point? is_a() and instanceof are ways of checking the class of an object at runtime where it could be any number of things. ( And here I'm assuming you mean instantiated instead of "loaded"? ) If you don't have an instantiated object.. what do you have? A class! And THAT can be checked at "compile" ( or in this case write ) time. There's something wrong with my code, if I'm thinking of this right, if I have no idea if class A is a subclass of class B. Now, if I'm passed random objects, I may want to know of which types they are... which is where these functions/builtins come in... Am I misunderstanding you? Dan Ostrowski