get_called_class

The "Late Static Binding" class name

Syntax

get_called_class ( void ) : string

Return

Returns the class name. Returns FALSE if called from outside a class.

Examples

<?

class myclass1
{
    static public function myfunction()
    {
        $return = get_called_class();

        echo $return . PHP_EOL;
    }
}
class myclass2 extends myclass1
{
}

myclass1::myfunction();
myclass2::myfunction();

?>
myclass1
myclass2

class_alias

class_exists

get_class

get_class_methods

get_class_vars

get_declared_classes

get_declared_interfaces

get_declared_traits

get_object_vars

get_parent_class

interface_exists

is_a

is_subclass_of

method_exists

property_exists

trait_exists

PHP

Home Menu