title: ArrayObject iteration
body: <h3>Problem:</h3>
  
  <p>ArrayObject works as expected when the values are set or read manually, but when using a function  (foreach for example) to iterate over it, things gets wicked.</p>
  
  <p>It doesn't call the offset* methods that I have defined but instead uses the ArrayIterator methods.</p>
  
  <p>Code:</p>
  
  <p>The Class:</p>
  
  <pre><code>class obsecureArray extends ArrayObject {
  
  
      public function offsetSet($name, $value) {
          call_user_func_array(array('parent', __FUNCTION__), array(base64_encode($name), base64_encode($value)) );
      }
  
      public function offsetGet($name) {
          return base64_decode( call_user_func_array(array('parent', __FUNCTION__), (array) base64_encode($name) ) );
      }
  
      public function offsetExists($name) {
          return call_user_func_array(array('parent', __FUNCTION__), (array) base64_encode($name) );
      }
  
      public function offsetUnset($name) {
          return call_user_func_array(array('parent', __FUNCTION__), (array) base64_encode($name) );
      }
  }
  </code></pre>
  
  <p></p>
  
  <p>Usage Example:</p>
  
  <pre><code>$a = new obsecureArray();
  $a['test'] = 'Value';
  $a[2] = '1';
  
  define('BR','&lt;br /&gt;');
  echo 'test: ',$a['test'],BR,'2: ',$a[2],BR;
  
  foreach($a as $key =&gt; $value)
      echo 'Key: ',$key,' Value:',$value,BR;
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>test: Value
  2: 1
  Key: dGVzdA== Value:VmFsdWU=
  Key: Mg== Value:MQ==
  </code></pre>
  
  <p><a href="http://codepad.viper-7.com/rm8jHl" rel="nofollow">CodePad example.</a></p>