Consider the following code.
What change must be made to the class for the code to work as written?
class Magic {
}
protected $v = array("a" => 1, "b" => 2, "c" => 3);
public function _get($v) {
return $th is->v[$v ];
$m = new Magic();
$m->d[] = 4;
echo $m->d[O];
A . Nothing, this code works just fine.
B . Add _set method doing $this->v[$var] = $val
C . Rewrite _get as: public function _get(&$v)
D . Rewrite _get as: public function &_get($v)
E . Make __get method static
Answer: D