How can the Scope Resolution Operator (::) be used in PHP to access static properties and methods of a class?

The Scope Resolution Operator (::) in PHP is used to access static properties and methods of a class without needing an instance of that class. To access a static property or method, you simply use the class name followed by the Scope Resolution Operator and then the property or method name. This allows you to work with static elements of a class directly without creating an object.

class MyClass {
    public static $staticProperty = 'Hello, World!';

    public static function staticMethod() {
        return 'This is a static method.';
    }
}

echo MyClass::$staticProperty; // Output: Hello, World!
echo MyClass::staticMethod(); // Output: This is a static method.