note 73461 deleted from language.operators.type by colder
| From: | colder@php.net | Date: | Sat, 24 Feb 2007 09:58:59 +0000 |
| Subject: | note 73461 deleted from language.operators.type by colder | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-123804@lists.php.net to get a copy of this message | ||
Note Submitter: Wombert
Reason: in docs
----
mikael dot knutsson at gmail dot com is wrong, the correct way to check if an object is NOT an
instance of a class is:
<?php
if(!($foo instanceof Bar)) {
// CORRECT
}
?>
If you do
<?php
if(!$foo instanceof Bar) {
// WRONG, WRONG, WRONG
}
?>
then the result of the expression is the instanceof comparison done on the negation of the object.
That's not what you want.