Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.
class Model {
public function render(){
echo '<br />class: '.get_class($this).' -- function: '.__FUNCTION__;
}
}
class Product extends Model {
public function show(){
$this->render();
}
}
class User extends Model {
public function index(){
$this->render();
}
}
$p = new Product();
$u = new User();
echo $p->show();
echo $u->index();
It is not odd at all that it shows a "different class".
$this is an instance of User in the case of $u->index(), and $this doesn't magically change type once you call a method inherited from parent class.
If __CLASS__ would have shown User on that call, then it would have been strange.