php - how to call another call method in other class? -


please read question first not mark duplicate. in many frameworks codeigniter etc. have seen call core class method like,

$this->load->view ();  

so trying achieve core php. have 2 classes test , test2. how can call test method test2

$this->test->index(); 

public function test1() {     $total = $this->test2();//calling test2() function     echo $total; }  public function test2() {     $sum = 1+2;     return $sum; } 

Comments