Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46471 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88009 invoked from network); 19 Dec 2009 00:53:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Dec 2009 00:53:40 -0000 Authentication-Results: pb1.pair.com smtp.mail=johannes@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=johannes@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 83.243.58.133 as permitted sender) X-PHP-List-Original-Sender: johannes@php.net X-Host-Fingerprint: 83.243.58.133 mailout1.netbeat.de Linux 2.6 Received: from [83.243.58.133] ([83.243.58.133:35771] helo=mailout1.netbeat.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 45/33-63064-1142C2B4 for ; Fri, 18 Dec 2009 19:53:39 -0500 Received: (qmail 7597 invoked by uid 89); 19 Dec 2009 01:00:41 -0000 Received: from unknown (HELO ?192.168.1.21?) (postmaster%schlueters.de@93.104.40.13) by mailout1.netbeat.de with ESMTPA; 19 Dec 2009 01:00:41 -0000 X-Originator: 9e51b244e0a38413ab6a9876e36ba9df To: Johannes Mueller Cc: internals@lists.php.net In-Reply-To: <83.E2.63064.C512C2B4@pb1.pair.com> References: <83.E2.63064.C512C2B4@pb1.pair.com> Content-Type: text/plain; charset="UTF-8" Organization: php.net Date: Sat, 19 Dec 2009 01:52:51 +0100 Message-ID: <1261183971.2756.1171.camel@guybrush> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] is_a() versus instanceof From: johannes@php.net (Johannes =?ISO-8859-1?Q?Schl=FCter?=) On Sat, 2009-12-19 at 01:42 +0100, Johannes Mueller wrote: > if($foo instanceof bar){ > .. > } > // runs without any notification instanceof is a language construct expecting a class identifier. It doesn't complain about on-existing classes as it would need to trigger the __autoloader which might be way too much. > and > > if(is_a($foo, bar)){ > .. > } > // runs with an undefined constant bar notification is_a() is a function expecting a string. And this warning is unrelated to the fact that the class "bar" doesn't exist, but due to the way PHP treats undefined constants. Behavior is expected, johannes