English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
PHP Class/Object function reference manual
get_called_class - Late Static Binding ("Late Static Binding") class name
get_called_class(void);
Get the class name of the static method call.
Number | Parameters and descriptions |
---|---|
1 | void void indicates that no parameters are required. |
Returns the class name, returns FALSE if not called within a class.
The following is the usage of this function-
<?php class foo { static public function test() { var_dump(get_called_class()); } } class bar extends foo { } foo::test(); bar::test(); ?>Test and see ‹/›
Output result:
string(3) "foo" string(3) "bar"