title: Custom foreach results for dynamic proxy class - magic methods?
body: <p>I need to serialize a proxy class. The class uses __set and __get to store values in an array. I want the serialization to look like it is just a flat object. In other words, my class looks like:</p>
  
  <pre><code>class Proxy
  {
      public $data = array();
      public function __get($name)
      { 
          return $data[$name] 
      }
  }
  </code></pre>
  
  <p>and I want a foreach loop to return all the keys and values in $data, when I say: </p>
  
  <pre><code>foreach($myProxy as $key)
  </code></pre>
  
  <p>Is this possible?</p>