note 45563 added to language.operators.type

From: Date: Fri, 10 Sep 2004 19:17:42 +0000
Subject: note 45563 added to language.operators.type
Groups: php.notes 
Request: Send a blank email to php-notes+get-76426@lists.php.net to get a copy of this message
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 ---- Manual Page -- http://www.php.net/manual/en/language.operators.type.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+45563 Delete -- http://master.php.net/manage/user-notes.php?action=delete+45563&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+45563&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#76426) next »