well, if u dunt want to modify the data inside the variable (array in ur example), u dun need a loop, like:
$arr = array(1,2,3,4,5,6,7);
//and u can do this without using any loop
if(isset($arr[$i]) && ($arr[$i] == 5))
echo "Its in the loop";
else echo "nothing";
but u probably knew that already.In case u want to modify the data then u can do this:
$arr = array(1,2,3,4,5,6,7);
$x = count($arr);
for($i=0;$i<$x;$i++)
{
$arr[$i] .= " "; // same as writing $arr[$i] = $arr[$i] . " "
}
//latter in script
if(isset($arr[$i]) && ($arr[$i] == 5))
echo "Its in the loop";
else echo "nothing";
I dunt kno if this is waht u wanted, if not, can u make ur question a bit more clearer?