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..
Regards Alan
Dan Ostrowski wrote:
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 check!
Isn't that the point? is_a() and instanceof are ways of checking the class of an object at runtime where it could be any number of things. ( And here I'm assuming you mean instantiated instead of "loaded"? )
If you don't have an instantiated object.. what do you have? A class! And THAT can be checked at "compile" ( or in this case write ) time. There's something wrong with my code, if I'm thinking of this right, if I have no idea if class A is a subclass of class B.
Now, if I'm passed random objects, I may want to know of which types they are... which is where these functions/builtins come in...
Am I misunderstanding you?
Dan Ostrowski
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php