title: Using __set with arrays solved, but why?
body: <p>Having done a bit of research, I eventually came across the answer to a question I was soon to ask here anyways; How do you work with arrays via the <code>__get</code> and <code>__set</code> magic methods in PHP? Whenever I was trying to set a value using something like <code>$object-&gt;foo['bar'] = 42;</code> it seemed to silently discard it.</p>
  
  <p>Anyways, the answer is simple; The <code>__get</code> method simply needs to return by reference. And after tossing an ampersand in front of it, sure enough it works.</p>
  
  <p>My question actually, is why? I can't seem to understand why this is working. How does <code>__get</code> returning by reference affect <code>__set</code> working with multidimensional arrays?</p>
  
  <p><em>Edit: By the way, running PHP 5.3.1</em></p>