oop - PHP get current class name in inherited class -


i have code in php:

abstract class development {        static function testunit()     {         echo get_class();     } }  class component extends development {     } 

but if calling component::testunit();

i receiving development instead of component. puzzling me because such static function has no meaning guess.

you want use get_called_class instead ... http://php.net/manual/en/function.get-called-class.php


Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

Bubble Sort Manually a Linked List in Java -

asp.net mvc - SSO between MVCForum and Umbraco7 -