How can one call a method from one class in another class in PHP?

To call a method from one class in another class in PHP, you can create an instance of the class containing the method within the other class and then call the method using the instance. This allows you to access the method and its functionality from the other class.

class Class1 {
    public function method1() {
        echo "Method 1 called";
    }
}

class Class2 {
    public function callMethod1() {
        $instance = new Class1();
        $instance->method1();
    }
}

$class2 = new Class2();
$class2->callMethod1();