Q. What will be the output?
Code:
class A { public function __toString() { return 'Hello'; } }
$obj = new A();
echo $obj;
β
Correct Answer: (A)
Hello
Explanation: __toString() is invoked when object is echoed.