OTECTED]>
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:
> > Ala
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
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_Err
Dan Ostrowski wrote:
On Tuesday 10 August 2004 7:36 pm, Hans Lellelid wrote:
The class must be loaded in order to perform an instanceof check!
*snip*
Am I misunderstanding you?
consider the following:
class Foo {}
$foo = unserialize('O:3:"Foo":0:{}');
echo '$foo is_a Foo? '. (is_a($foo, 'Foo')
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
On Tuesday 10 August 2004 7:36 pm, Hans Lellelid wrote:
> I like the new $obj instanceof ClassName way of checking class /
> interface types, but this method does have one major drawback
> compared to the old is_a() approach:
>
> The class must be loaded in order to perform an instanceof c
I like the new $obj instanceof ClassName way of checking class /
interface types, but this method does have one major drawback
compared to the old is_a() approach:
The class must be loaded in order to perform an instanceof check!
Apparently is_a() has also been deprecated, so that an E_