title: How to return the object value within for loop?
body: <p>Okay so i am trying to retrieve the object value iterating through a for loop.</p>
  
  <p>Manually it looks like this:</p>
  
  <pre><code>echo $game-&gt;stats-&gt;item0;
  echo $game-&gt;stats-&gt;item1;
  ...
  </code></pre>
  
  <p>I want to do it something like this:</p>
  
  <pre><code>for($i = 0; $i &lt; 6; $i++) {
      echo $game-&gt;stats-&gt;item.$i;
  }
  </code></pre>
  
  <p>The above however just returns the value of $i. How can i return the actual object value?</p>
  
  <p>Thanks</p>