What happens when a public method is called as static in PHP?

When a public method is called as static in PHP, it can lead to a fatal error because static methods are called on the class itself, not on an instance of the class. To solve this issue, you can either make the method static or create an instance of the class and call the method on that instance.

class MyClass {
    public static function myMethod() {
        // method logic here
    }
}

// Calling the method as static
MyClass::myMethod();

// Calling the method on an instance of the class
$instance = new MyClass();
$instance->myMethod();