Get name of extending class with static method call
| From: | Torsten Roehr | Date: | Tue, 11 Jan 2005 16:08:27 +0000 |
| Subject: | Get name of extending class with static method call | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-206080@lists.php.net to get a copy of this message | ||
Hi list,
in PHP4 it was possible to get the name of the calling class with
debug_bcktrace(). Unfortunately this behaviour has been changed in PHP5. I
didn't find a solution in the archives.
Is there *any* way to get the name of the calling class?:
class Car {
function drive() {
// I need the name of the calling class here
// in this case it should be 'Porsche'
}
}
class Porsche extends Car {
}
Porsche::drive();
Any help is greatly appreciated!
Thanks and best regards,
Torsten Roehr