Get_class (): Gets the class name of the current calling method;
Get_called_class (): Gets the class name after the static binding;
There are examples of evidence:
classfoo{ Public functionTest () {Var_dump(Get_class()); } Public functiontest2 () {Var_dump(Get_called_class ()); } Public Static functiontest3 () {Var_dump(Get_class()); } Public Static functiontest4 () {Var_dump(Get_called_class ()); } } classBextendsfoo{}$B=NewB (); $B-test (); $B-test2 (); Foo::test3 (); Foo::test4 (); B::test3 (); B:: Test4 ();
Output Result:
string ' foo ' (length=3) string ' B ' (length=1)string ' Foo ' (length=3)string ' foo ' (length=3)string ' foo ' (length=3)string ' B ' (length=1)
Ext.: http://blog.csdn.net/tashanhongye/article/details/48159771
Reference: http://php.net/manual/zh/function.get-called-class.php
The difference between PHP Get_called_class () function and Get_class function