How does the use of static:: differ from self:: when accessing properties in PHP classes with inheritance?

When accessing properties in PHP classes with inheritance, using static:: allows for late static binding, meaning the property will be resolved at runtime based on the calling class, rather than the class where the method is defined. This can be useful when working with overridden properties in child classes. On the other hand, using self:: always resolves the property based on the class where the method is defined, which may not always be the desired behavior when dealing with inheritance.

class ParentClass {
    public static $property = 'Parent';
    
    public static function getParentProperty() {
        return static::$property;
    }
}

class ChildClass extends ParentClass {
    public static $property = 'Child';
    
    public static function getChildProperty() {
        return self::$property;
    }
}

echo ParentClass::getParentProperty(); // Output: Parent
echo ChildClass::getParentProperty(); // Output: Child
echo ChildClass::getChildProperty(); // Output: Child