Re: [PHP] Get name of extending class with static method call

2005-01-12 Thread Torsten Roehr
I'm not sure if this will work, but hey, you could give it a try. class Car { public static $className = __CLASS__; public static function drive () { return self::$className; } } class Porsche extends Car { public static $className = __CLASS__; }

[PHP] Get name of extending class with static method call

2005-01-11 Thread Torsten Roehr
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

Re: [PHP] Get name of extending class with static method call

2005-01-11 Thread Christopher Fulton
Not sure if this is the best way to do it or not, but you can do this and it should (untested code) work. class Car { function drive() { return $this-getClassName(); } function getClassName() { return Car; } } class Porshe {

Re: [PHP] Get name of extending class with static method call

2005-01-11 Thread Torsten Roehr
Christopher Fulton [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Not sure if this is the best way to do it or not, but you can do this and it should (untested code) work. class Car { function drive() { return $this-getClassName(); }

Re: [PHP] Get name of extending class with static method call

2005-01-11 Thread Daniel Schierbeck
Torsten Roehr wrote: Christopher Fulton [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Not sure if this is the best way to do it or not, but you can do this and it should (untested code) work. class Car { function drive() { return $this-getClassName(); }