php Programming Glossary: get_called_class
PHP and Enumerations http://stackoverflow.com/questions/254514/php-and-enumerations if self constCache NULL reflect new ReflectionClass get_called_class self constCache reflect getConstants return self constCache..
Getting the name of a child class in the parent class (static context) http://stackoverflow.com/questions/283004/getting-the-name-of-a-child-class-in-the-parent-class-static-context src . class Base public static function whoAmI return get_called_class class User extends Base print Base whoAmI prints Base print..
Extending singletons in PHP http://stackoverflow.com/questions/3126130/extending-singletons-in-php function getInstance static instances array calledClass get_called_class if isset instances calledClass instances calledClass new calledClass.. fs FileService getInstance If you use PHP 5.3 add this too get_called_class is only in PHP 5.3. if function_exists 'get_called_class' function.. get_called_class is only in PHP 5.3. if function_exists 'get_called_class' function get_called_class bt debug_backtrace l 0 do l lines..
Peculiar Behaviour with PHP (5.3), static inheritance and references http://stackoverflow.com/questions/3187124/peculiar-behaviour-with-php-5-3-static-inheritance-and-references function break_static_references self new ReflectionClass get_called_class foreach self getStaticProperties as var val static var val .....
PHP get_called_class() alternative http://stackoverflow.com/questions/3498510/php-get-called-class-alternative get_called_class alternative I've got an Abstract PHP superclass which contains.. under. class Foo static function _get_class_name return get_called_class works in PHP 5.3. but not in PHP 5.2. static function other_code.. i need 'FooBar' This would work if I called the function get_called_class however this code is going to be run in PHP version 5.2. so..
PHP: get classname from static call in extended class http://stackoverflow.com/questions/506705/php-get-classname-from-static-call-in-extended-class you were called through it does provide a new function get_called_class which can tell you the name of the class a static method was.. an example Class Action public static function n return get_called_class class MyAction extends Action echo MyAction n displays MyAction..
New self vs. new static http://stackoverflow.com/questions/5197300/new-self-vs-new-static whereas static is bound to the called class also see get_called_class . class A public static function get_self return new self public..
|