get_called_class
(PHP 5 >= 5.3.0)
get_called_class — the "Late Static Binding" class name
Descrição
string get_called_class
( void
)
Gets the name of the class the static method is called in.
Valor Retornado
Returns the class name. Returns FALSE if called from outside a class.
Exemplos
Example #1 Using get_called_class()
<?php
class foo {
static public function test() {
var_dump(get_called_class());
}
}
class bar extends foo {
}
foo::test();
bar::test();
?>
O exemplo acima irá imprimir:
string(3) "foo" string(3) "bar"
Veja Também
- get_parent_class() - Recupera o nome da classe pai para o objeto ou classe
- get_class() - Retorna o nome da classe de um objeto
- is_subclass_of() - Verifica se o objeto tem esta classe como uma de suas classes pai