Re: is_a() versus instanceof

From: Date: Sat, 19 Dec 2009 00:52:51 +0000
Subject: Re: is_a() versus instanceof
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-46471@lists.php.net to get a copy of this message
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

« previous php.internals (#46471) next »