Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:12118 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92733 invoked by uid 1010); 12 Aug 2004 09:59:20 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 92382 invoked from network); 12 Aug 2004 09:59:17 -0000 Received: from unknown (HELO dbmail-mx10.orcon.net.nz) (219.88.242.2) by pb1.pair.com with SMTP; 12 Aug 2004 09:59:17 -0000 Received: from galaxy (port-222-152-50-62.fastadsl.net.nz [222.152.50.62]) (authenticated bits=0) by dbmail-mx10.orcon.net.nz (8.12.11/8.12.11/Debian-5) with ESMTP id i7C9qoR9015294; Thu, 12 Aug 2004 21:59:09 +1200 Message-ID: <04d401c48053$6ada0350$0a00a8c0@home.jevon.org> To: "Al Baker" , References: <41196A1D.6060808@velum.net> <200408112219.55268.dan@ostrowski.cc> <411AE454.4060808@akbkhome.com> <411AE970.2080908@velum.net> <1092304734.6882.2.camel@localhost> Date: Thu, 12 Aug 2004 21:51:15 +1200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-Virus-Scanned: clamd / ClamAV version 0.73, clamav-milter version 0.73a on dbmail-mx10.orcon.net.nz X-Virus-Status: Clean Subject: Re: [PHP-DEV] is_a() vs. instanceof From: jevon@jevon.org ("Jevon Wright") What about: if (get_class($obj) == "unloadedclass") { // blah } Jevon ----- Original Message ----- From: "Al Baker" To: "Hans Lellelid" Cc: "Dan Ostrowski" ; Sent: Thursday, August 12, 2004 9:58 PM Subject: Re: [PHP-DEV] is_a() vs. instanceof > I agree, that's the exact behavior I would like as well and what most > people would expect. > > Al > > On Wed, 2004-08-11 at 23:52 -0400, Hans Lellelid wrote: > > Alan Knowles wrote: > > > > > I think he's referening to something like this (which is common in pear): > > > > > > $x = $someobj->somemethod(); > > > if ($x instanceOf PEAR_Error) { > > > ....... > > > } > > > > > > while that code is redundant in the case of exceptions, it is still a > > > valid situation.. that $x may be a valid return, and PEAR_Error was > > > never loaded.. > > > > > > Yup, that's exactly what I'm talking about. > > > > I want to be able to do this: > > > > if ($db instanceof DBPostgres) { > > /// do something funky specific to Postgres > > } > > > > If My DB adapter is DBMySQL, I don't want to load the DBPostgres adapter > > just so I can test whether my object is of that type ... > > > > and checking first whether class_exists('DBPostgres') just seems kinda > > kludgy & straying from the "problem domain" ... especially since $db > > instanceof DBPostgres would *always* be false if DBPostgres isn't loaded. > > > > Hans > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >