Edit: What you are trying to achieve is not possible with PHP 5.1. In PHP 5.1, there are no late static bindings for PHP Manual , you need to explicitly name the child class to call the child function: Test123456::test() , self will be Test123 in the static function of the Test123 class (always), and the static not available for calling the static function in PHP 5.1.
Related: the new self versus the new static ; PHP 5.2 Equivalent to late static binding (new static)?
If you are referring to a static parent function, you need to explicitly specify the parent (or child) function call in php 5.1:
parentClass::func(); Test123456::test();
In PHP 5.3, you can do this instead of the static keyword PHP Manual to resolve the name of the called class:
static::func(); static::test();
If they are non-static, just use the $this PHP Guide :
$this->parentFunc(); $this->childFunc();
Or, if it has the same name, use the parent PHP Guide :
parent::parentFunc();
(this is not exactly what you requested, just placing it here for completeness).
Get_called_class () was introduced for very specific cases, such as the late static bindings PHP manual .
See Object Inheritance PHP Manual
hakre source share