Re: Get name of extending class with static method call

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



try using __CLASS__

Torsten Roehr wrote:

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

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux