Re: is_a() versus instanceof
| From: | Jille Timmermans | Date: | Sat, 19 Dec 2009 01:41:41 +0000 |
| Subject: | Re: is_a() versus instanceof | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-46473@lists.php.net to get a copy of this message | ||
Johannes Schlüter schreef:
> 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.
>
Wouldn't it be an idea to make a setting for this ? I find it very
annoying (however understandable) it doesn't complain if I make a typo..
I assume this works the same as try-catch(Exceptio $e); (note the
missing 'n'); which got me fooled before.
(To be sure to be understood: Create a setting which does check the
class-existance; even when autoloading must be called for it)
-- Jille