<?php
class A
{
public static function who()
{
var_dump(get_called_class());
}
}
class B extends A
{
public static function who()
{
parent::who();
}
}
B::who();
call_user_func(array('B', 'parent::who'));
string(1) "B"
Fatal error: Uncaught Error: get_called_class() must be called from within a class in /in/uon8H:6
Stack trace:
#0 /in/uon8H(17): A::who()
#1 {main}
thrown in /in/uon8H on line 6
Process exited with code 255.
Fatal error: Call to undefined function get_called_class() in /in/uon8H on line 6
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/uon8H on line 4
Process exited with code 255.
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/uon8H on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/uon8H on line 4
Process exited with code 255.