In one class I call $this->view() which will be handled by its extended class. But how can I get the name of the method in the parent view();
To make it somewhat clearer:
<?php
class UsersController extends Controller
public function signup() {
$this->view();
}
}
class Controller {
public function view() {
// How can I get 'signup' so that I can include 'views/Users/signup.php'
}
}
?>
While you could, in theory, determine the name of the calling method with
debug_bugtrace, the far simpler (and therefore better) solution is: