lundi 6 avril 2015

Foreach and if broken

i have this code, and it still worked properly while...



$out_1 = array('284','345','456','284');
$a1 = '<img src="';
$a2 = '"/>';
$i = 0;

foreach ( $out_1 as $ar_1 ) {
if ($out_3[$i] == 284)
echo $a1.$out_2[$i].$a2;
{
$i++;
}
}

?>


see below, $aaa it is example variable. (string or number).



foreach ( $out_1 as $ar_1 ) {
if ($out_3[$i] == 284)
echo $aaa;

echo $a1.$out_2[$i].$a2;
{
$i++;
}
}
?>


And now this code not understand my IF construction. Why? Please help!


Aucun commentaire:

Enregistrer un commentaire