title: using the magic __set() method with 2D arrays
body: <p>If I have the following registry class:</p>
  
  <pre><code>Class registry 
  {
      private $_vars;
  
      public function __construct()
      {
          $this-&gt;_vars = array();
      }
  
      public function __set($key, $val)
      {
          $this-&gt;_vars[$key] = $val;
      }
  
      public function __get($key)
      {
          if (isset($this-&gt;_vars[$key]))
              return $this-&gt;_vars[$key];
      }
  
      public function printAll()
      {
          print "&lt;pre&gt;".print_r($this-&gt;_vars,true)."&lt;/pre&gt;";
      }
  }
  
  $reg = new registry();
  
  $reg-&gt;arr = array(1,2,3);
  $reg-&gt;arr = array_merge($reg-&gt;arr,array(4));
  
  $reg-&gt;printAll();
  </code></pre>
  
  <p>Would there be an easier way to push a new item onto the 'arr' array? 
  This code: 'array[] = item' doesn't work with the magic set method, and I couldn't find any useful info with google. Thanks for your time!</p>