Understanding what does $this exactly do:
<?php
class toop {
public $i = "1234";
public function setv($a) {
$this->i = $a;
}
public function returnthis() {
return $this;
}
}
$ob = new toop();
$ob1 = new toop();
$obthis = $ob->returnthis();
echo $ob->i."\n";
$ob->setv("\$ob set");
echo $ob->i."\n";
$obthis->setv("\$obthis set");
echo $ob->i."\n";
$ob1->setv('$ob1 set');
echo $ob->i."\n";
?>
This will output:
1234
$ob set
$obthis set
$obthis set