i have a strange behaviour with my script, the foreach loop only stops if i echo results, so it just continues to insert values... Only stops if i use echo to show some iterations... Below is important part of code:
$looparray=array
(
"1"=>array(
"something1",
"something2",
"something3",
),
"2"=>array(
),
"3"=>array(
),
"4"=>array(
),
"5"=>array(
),
"6"=>array(
)
);
foreach ($looparray as $key => $value) {
if(count($value)=='0') // skip empty arrays
{
continue;
}
foreach ($value as $singlevalue) {
for ($i=0; $i<=5; $i++)
{
echo $i . '<br />'; //if i don't use it, neverending loop ?!
}
}
}
So if i'm not echo-ing then loop is not stopping at 5... Of course i have a lot of stop in the inner for loop, but those are not important... So why is it happening?