title: PHP foreach loop breaking with sub object
body: <p>I'm trying to access third party api which gives me object and sub object, for example:</p>
  
  <pre><code>stdClass Object
  (
      [truncated] =&gt; 
      [text] =&gt; "some text"
      [user] =&gt; stdClass Object
          (
              [count] =&gt; 9370
              [comments_enabled] =&gt; yes
  </code></pre>
  
  <p>When I try and loop through the object with the following code I get an error at the start of sub-object 'user'. Can anyone help me either 1) iterate through the sub-object, or 2) block the sub-object from the loop.</p>
  
  <p>The code:</p>
  
  <pre><code>$test = $s[0];
  $obj = new ArrayObject($test);
  foreach ($obj as $data =&gt; $name) {
  print $data . ' - ' . $name . '&lt;br /&gt;';
  }
  </code></pre>
  
  <p>thanks</p>