How can the concept of inheritance be applied in PHP classes, specifically when accessing parent objects?

When working with inheritance in PHP classes, you may need to access properties or methods from a parent class within a child class. This can be achieved using the `parent` keyword followed by `::` to access static properties or methods, or `->` to access non-static properties or methods of the parent class.

class ParentClass {
    protected $parentProperty = 'Parent property';

    protected function parentMethod() {
        return 'Parent method';
    }
}

class ChildClass extends ParentClass {
    public function getChildData() {
        $parentProperty = $this->parentProperty;
        $parentMethod = parent::parentMethod();

        return [$parentProperty, $parentMethod];
    }
}

$child = new ChildClass();
$data = $child->getChildData();
print_r($data);