note 29006 deleted from function.get-class by peehaa
| From: | peehaa@php.net | Date: | Tue, 29 Nov 2016 10:24:08 +0000 |
| Subject: | note 29006 deleted from function.get-class by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-207733@lists.php.net to get a copy of this message | ||
Note Submitter: Dan
----
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
)