You can use Magic Methods to achieve this behavior:
public function __call($func, $args) { if(!method_exists($this, $func)) { return; } // do some coding here call_user_func_array($func,$args); // do some coding there } private function view($arg1, $arg2) { // and here }
Remember: the viewing function must be private / secure.
$obj->view("asdasd", "asdsad");
Must execute :: __ call (), then :: view () method
source share