Q. What will be the output?
Code:
class A {
public function __get($name) { return 'magic'; }
}
$obj = new A();
echo $obj->x;
β
Correct Answer: (A)
magic
Explanation: __get is invoked for inaccessible properties.