note 43871 deleted from language.operators.type by colder
| From: | colder@php.net | Date: | Sat, 24 Feb 2007 09:59:56 +0000 |
| Subject: | note 43871 deleted from language.operators.type by colder | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-123805@lists.php.net to get a copy of this message | ||
Note Submitter: Jesse Scott (scotje at wwc dot edu)
----
Since it's not stated authoritatively here, I'll add that instanceof *does* check all the
way up the inheritence tree.
So in this code:
<?php
class A
{
var $someProp;
}
class B extends A
{
function showProp()
{
echo $someProp;
}
}
$obj1 = new B;
if ($obj1 instanceof A)
echo "Instanceof checks inheritence tree!";
else
echo "Instanceof does not check inheritence tree!";
?>
The first branch of the if/else block is executed since ($obj1 instanceof A) evaulates to TRUE.