note 97405 deleted from language.operators.type by degeberg
| From: | degeberg@php.net | Date: | Sun, 18 Apr 2010 18:47:53 +0000 |
| Subject: | note 97405 deleted from language.operators.type by degeberg | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-168371@lists.php.net to get a copy of this message | ||
Note Submitter: Chris
----
I'm surprised this hasn't been brought up yet, but since this isn't stated in the
documentation it is probably worth pointing out that instanceof does behave as expected when called
from a parent class.
<?php
class ClassA
{
public function __construct()
{
var_dump($this instanceof ClassB);
}
}
class ClassB extends ClassA
{
}
$a = new ClassA; // bool(false)
$b = new ClassB; // bool(true)
?>