note 13817 added to keyword.paamayim_nekudotayim.php
| From: | robinv at ecosse dot net | Date: | Wed, 04 Jul 2001 12:32:58 +0000 |
| Subject: | note 13817 added to keyword.paamayim_nekudotayim.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-14970@lists.php.net to get a copy of this message | ||
Variable Class Names (PHP 4.05):
class A {
function example() {
return 'example!';
}
}
$class = 'A';
$instance = 'a';
$a = new A;
// While you can do this in PHP4:
print ${$instance}->example();
// The parser won't allow this:
print ${$class}::example();
// A workaround is to use eval()
print eval("return $class::example();");
http://www.php.net/manual/en/keyword.paamayim_nekudotayim.php