How can a method in a child class be checked for existence from a method in the parent class in PHP?

To check if a method in a child class exists from a method in the parent class in PHP, you can use the `method_exists()` function. This function takes two parameters: the object instance and the method name as strings. It will return `true` if the method exists in the child class and `false` otherwise.

class ParentClass {
    public function checkChildMethod($childInstance, $methodName) {
        if (method_exists($childInstance, $methodName)) {
            echo "Method $methodName exists in the child class.";
        } else {
            echo "Method $methodName does not exist in the child class.";
        }
    }
}

class ChildClass extends ParentClass {
    public function childMethod() {
        // Method implementation
    }
}

$childInstance = new ChildClass();
$parentInstance = new ParentClass();

$parentInstance->checkChildMethod($childInstance, 'childMethod');