Converting a Foreach to a for loop
<p>I have a 3rd party script that loops through every returned value and echos it. </p>

<p>I want to limit the amount to 3 loops but am having issues.</p>

<p>current loop:</p>

<pre><code>  foreach($json-&gt;data as $v)
  {
  echo  $v-&gt;from-&gt;name."&lt;br&gt;";
  }
</code></pre>

<p>I want to do something like:</p>

<pre><code>for ($i=0;$i&lt;3;$i++)
                {
  echo  $v-&gt;from-&gt;name."&lt;br&gt;";
 }
</code></pre>

<p>Is there any work around without having to rework the whole script.</p>
