note 29006 added to function.get-class

From: Date: Thu, 30 Jan 2003 04:00:16 +0000
Subject: note 29006 added to function.get-class
Groups: php.notes 
Request: Send a blank email to php-notes+get-43117@lists.php.net to get a copy of this message
This function does return the class name in lowercase, but that does not seem to make any difference. The code below, although very sloppy, works fine in all of the following configurations. PHP 4.2.2 on Windows NT5 with Apache 1.3.24 PHP 4.2.1 in Zend Development Environment on box above PHP 4.2.3 on Linux RedHat 7.3 with Apache 1.3.27 class TeSt { var $a; var $b = "Fred"; // Notice the case difference in the constructor name function Test() { $classname = get_class($this); // $classname = "test" $this->ra = get_class_vars($classname); } } // Next line also works with Test(), TEST(), or test() $obj = new TeSt(); print_r($obj->ra); Result : Array ( [a] => [b] => Fred ) -- http://www.php.net/manual/en/function.get-class.php http://master.php.net/manage/user-notes.php?action=edit+29006 http://master.php.net/manage/user-notes.php?action=delete+29006 http://master.php.net/manage/user-notes.php?action=reject+29006

« previous php.notes (#43117) next »