What is the best practice for calling a method in all functions inherited from a parent class in PHP?

When we want to ensure that a method is called in all functions inherited from a parent class in PHP, we can use the `parent::methodName()` syntax within each child class function. This allows us to call the parent class method before or after the child class method executes, ensuring that the parent class method is always invoked.

class ParentClass {
    public function commonMethod() {
        echo "This method is called in all child class functions.\n";
    }
}

class ChildClass extends ParentClass {
    public function childMethod() {
        parent::commonMethod();
        echo "Child class specific code here.\n";
    }
}

$child = new ChildClass();
$child->childMethod();