Re: Re: RC1, instanceof?
| From: | Pierre-Alain Joye | Date: | Tue, 09 Aug 2005 10:30:33 +0000 |
| Subject: | Re: Re: RC1, instanceof? | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-17684@lists.php.net to get a copy of this message | ||
On Tue, 09 Aug 2005 13:24:56 +0300
pasha.zubkov@gmail.com (Pasha Zubkov) wrote:
> Alan Knowles wrote:
> > The basic point is that is_a() provided negative testing of
> > non-existant classes
> > if (!is_a($obj, "SomeRarelyUsedClass")) { ....
> >
> > instance_of does not, and can not, at present.
>
> You can use
if (!($obj instanceof SomeRarelyUsedClass)) ;)
>
> Why statement $obj instanceof NotLoadedClass can't
> evaluate as
> FALSE if class not loaded (what with serialized objects?) because
> if class not loaded, than object can't be instanceof this class,
> right?
We do __not__ know that.
This test tries to figure that out, exactly that. So no, it must
not end to a fatal error.
--Pierre