class Test
{
private string m1 = '';
private string m2 = '';
public function m1()
{
//code
$this->m1 = $res1;
}
public function m2()
{
//code
$this->m2 = $res2;
}
public function __toString(): string
{
return $this->m1 . ' - ' . $this->m2;
}
}
$obj = new Test();
$obj->m1();
$obj->m2();
echo $obj;