note 97405 added to language.operators.type
| From: | Chris at osu1 dot php dot net | Date: | Sun, 18 Apr 2010 18:28:53 +0000 |
| Subject: | note 97405 added to language.operators.type | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-168370@lists.php.net to get a copy of this message | ||
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)
?>
----
Server IP: 69.147.83.197
Probable Submitter: 91.135.9.60
----
Manual Page -- http://www.php.net/manual/en/language.operators.type.php
Edit -- https://master.php.net/note/edit/97405
Del: integrated -- https://master.php.net/note/delete/97405/integrated
Del: useless -- https://master.php.net/note/delete/97405/useless
Del: bad code -- https://master.php.net/note/delete/97405/bad+code
Del: spam -- https://master.php.net/note/delete/97405/spam
Del: non-english -- https://master.php.net/note/delete/97405/non-english
Del: in docs -- https://master.php.net/note/delete/97405/in+docs
Del: other reasons-- https://master.php.net/note/delete/97405
Reject -- https://master.php.net/note/reject/97405
Search -- https://master.php.net/manage/user-notes.php