This should work for you then....(maybe...i don't have php5 on my system, so it may not, but i think it would. http://us4.php.net/manual/en/function.get-class.php class Car { function drive() { return get_class($this); } } class Porshe { } $foo = new Porshe(); echo $foo->drive(); On Tue, 11 Jan 2005 14:24:46 -0500, Jason Barnett <jason.barnett@xxxxxxxxxxxxx> wrote: > > > > __CLASS__ contains the name of the class the method is in. In my sample it > > would be 'Car' and not 'Porsche'. > > > > What I don't understand is why the behaviour of debug_backtrace() has been > > changed!?! > > > > Regards, Torsten > > I have no idea why the behaviour changed (I didn't really use the > function before, either). And I see now the change in the manual that > addresses this (essentially debug_backtrace gives you __CLASS__) > > If you had an actual instance of the class you could use get_class, but > alas you are using a static method call. You punk. > > The only other solution that comes to mind is a little messy but it lets > you get away with no object. Instead of calling the method statically > you can use call_user_func_array() with the child class name as a > parameter. Then change the parent method to accept the child class name > as a parameter. > > <?php > > function call_static_child() { > $drive_args = func_get_args(); > /** assume that first parameter is child of class Car */ > return call_user_func_array(array($drive_args[0], 'drive'), $drive_args); > } > > ?> > > > -- > Teach a person to fish... > > Ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html > PHP Manual: http://www.php.net/manual/en/index.php > php-general archives: http://marc.theaimsgroup.com/?l=php-general&w=2 > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php