<?php class Controller { public function index($otherObj) { echo "Calling Controller::index\n"; if (method_exists($this, 'hook_' . __FUNCTION__)) { $this->{'hook_' . __FUNCTION__}(); } if (method_exists($otherObj, 'hook_' . __FUNCTION__)) { $otherObj->{'hook_' . __FUNCTION__}(); } } public function hook_index() { echo "Calling Controller::hook_index\n"; } } class LocalController { public function hook_index() { echo "Calling LocalController::hook_index\n"; } } $localController = new LocalController(); $controller = new Controller(); $controller->index($localController);
You have javascript disabled. You will not be able to edit any code.