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,
$i = 0;
$colors = array("red","green","blue","yellow");
foreach ($colors as $value)
{
$i++;
if($i==2) break;
echo "$value <br>";
}