<?php class one{ public function index($called_from = null){ if ( $called_from != 'myfunc') { return $this->myfunc(__FUNCTION__); } else { echo 'parent'; } } public function myfunc($called_from){ return $this->$called_from(__FUNCTION__); } } class two extends one{ function index($called_from = null){ if ( $called_from != 'myfunc') { return $this->myfunc(__FUNCTION__); } else { echo 'child'; } } } $obj = new two; $obj->index();
You have javascript disabled. You will not be able to edit any code.