title: Display specific value from PHP foreach loop
body: <p>I have a simple foreach loop in PHP. I want to get specific value from that loop. I can get the 1st value with the below code but is it possible to get only 2nd or 3rd value from the same loop. My code to get first value is below,</p>
  
  <pre><code>$i = 0;
  $colors = array("red","green","blue","yellow"); 
  foreach ($colors as $value)
  {
    $i++;
    if($i==2) break;
    echo "$value &lt;br&gt;";
  }
  </code></pre>