Hi all,
i have this code
and i was able to get it deleting (or commenting) the "foreach" loop.
How can i modify it to have the same result without removing the "foreach"
since it seems required to handle the $items array?
Thanks in advance,ronnie.
i have this code
Code:
$i = 0;
while ($i <= 3 ){
$id = $i++;
$items = array("a" => "item1", "b" => "item2", "c" => "item3");
foreach ($items as $item) {
echo "sometext_".$id."<br />";
}
}
[/code ]
it actually outputs
[code]
sometext_0
sometext_0
sometext_0
sometext_1
sometext_1
sometext_1
sometext_2
sometext_2
sometext_2
sometext_3
sometext_3
sometext_3
[/code ]
I need to have this
[code]
sometext_0
sometext_1
sometext_2
sometext_3
and i was able to get it deleting (or commenting) the "foreach" loop.
How can i modify it to have the same result without removing the "foreach"
since it seems required to handle the $items array?
Thanks in advance,ronnie.