note 46108 added to function.get-class

From: Date: Wed, 29 Sep 2004 19:01:28 +0000
Subject: note 46108 added to function.get-class
Groups: php.notes 
Request: Send a blank email to php-notes+get-77578@lists.php.net to get a copy of this message
As the previous poster states, this function returns the class name in lowercase, and this can break a class comparison. For example, if you run this: <?php class testClass { var $myVar; } function testForClass($aTestObject) { if (get_class($sTestObject) == "testClass") return TRUE; else return FALSE; } $myObj = new testClass; testForClass($myObj); ?> running this code will return FALSE, since the "==" operator is case sensitive. ---- Manual Page -- http://www.php.net/manual/en/function.get-class.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+46108 Delete -- http://master.php.net/manage/user-notes.php?action=delete+46108&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+46108&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#77578) next »