'PHP return $this;
My question is a simple one. When returning a var_dump of $this I am getting the object and the properties inside. My question in: Shouldn't it return the methods also?
class Test{
private $num = 5;
protected $dum = 9;
private function see(){
return "I see";
}
public function returnThis(){
return var_dump($this);
}
}
$test = new Test();
$test->returnThis();
Result:
object(Test)#1 (2) {
["num":"Test":private]=>
int(5)
["dum":protected]=>
int(9)
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
