If you only need access to the ClassB method from ClassA, but there is no parent-child relationship between them, a static method may be more appropriate:
class ClassA { public function method1() { echo ClassB::method2(); } } class ClassB { public static function method2() { return 'WOOT!'; } } $cls_a = new ClassA(); $cls_a->method1();
source share