PHP.nl

get_called_class

get_called_class

The "Late Static Binding" class name

string **get_called_class**

Gets the name of the class the static method is called in.

Returns the class name.

If is called from outside a class, an is thrown. Prior to PHP 8.0.0, an level error was raised. get_called_class``Error``E_WARNING

**Voorbeeld: Using **

<?php

class foo {
    static public function test() {
        var_dump(get_called_class());
    }
}

class bar extends foo {
}

foo::test();
bar::test();

?>
string(3) "foo"
string(3) "bar"

get_parent_class``get_class``is_subclass_of