title: (PHP) Why is this the output of the following echo?
body: <p>I'm going through some PHP question for my exam, and in the question below, apparently (B) is the answer.</p>
  
  <blockquote>
    <p>What is the output of the following code?
        
  
  <pre><code>class Magic {
    public $a = 'A';
    protected $b = array('a' =&gt; 'A', 'b' =&gt; 'B', 'c' =&gt; 'C');
    protected $c = array(1, 2, 3);
  
    public function __get($v) {
      echo "$v,";
      return $this-&gt;b[$v];
    }
  
    public function __set($var, $val) {
      echo "$var: $val,";
      $this-&gt;$var = $val;
    }
  }
  
  $m = new Magic;
  echo $m-&gt;a.','.$m-&gt;b.','.$m-&gt;c.',';
  $m-&gt;c = 'CC';
  echo $m-&gt;a.','.$m-&gt;b.','.$m-&gt;c;
  </code></pre>
    
    <ul>
    <li>A: A,Array,Array,A,Array,Array,CC</li>
    <li>B: b,c,A,B,C,c: CC,b,c,A,B,C</li>
    <li>C: a,b,c,A,B,C,c: CC,a,b,c,A,B,C</li>
    <li>D: b,c,A,B,C,c: CC,b,c,A,B,CC</li>
    </ul>
  </blockquote>
  
  <p>Sorry for the noob question, but coming from Java, I can't for the life of me understand why this is the correct answer.</p>