note 45563 deleted from language.operators.type by colder
| From: | colder@php.net | Date: | Sat, 24 Feb 2007 10:00:32 +0000 |
| Subject: | note 45563 deleted from language.operators.type by colder | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-123807@lists.php.net to get a copy of this message | ||
Note Submitter: zimba dot spam at gmail dot com
----
instanceof cannot use a string for the comparison like is_a.
Instead, you can use a class instance (not documented)
Example :
<?
$x = new myClass();
$y = new myClass();
echo is_a($x, get_class($y)); // Returns true/1
echo $x instanceof get_class($y); // Doesn't work, instead use :
echo $x instanceof $y;
?>
Cheers,
zimba