note 43871 added to language.operators.type
| From: | (scotjeatwwcdotedu) | Date: | Tue, 06 Jul 2004 22:52:48 +0000 |
| Subject: | note 43871 added to language.operators.type | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-72799@lists.php.net to get a copy of this message | ||
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.
----
Manual Page -- http://www.php.net/manual/en/language.operators.type.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+43871
Delete -- http://master.php.net/manage/user-notes.php?action=delete+43871&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+43871&report=yes
Search -- http://master.php.net/manage/user-notes.php