What is the alternative to using the __CLASS__ keyword in PHP?

When trying to access the current class name in PHP without using the __CLASS__ keyword, you can use the get_class() function instead. This function returns the name of the class of an object or the name of the class of the object that called the function in a static context.

class MyClass {
    public function getClassName() {
        return get_class($this);
    }
}

$obj = new MyClass();
echo $obj->getClassName(); // Output: MyClass