Hi jobo!
Was ist an der Runterzählerei richtiger? Abgesehen davon, dass die while-Schleife nicht nötig ist.
Die while-Schleife ist einfach falsch:
$count = 1;
while ($count <= 5)
{
foreach(...)
{
// ...
$count ++;
}
}
Wenn $count
(wieder) überprüft wird, ist foreach
schon längst fertig mit seiner Arbeit.
Wie soll die äußere while
-Schleife also ihre Bedingung überprüfen, wenn sie die Kontrolle erst erhält, wenn die Kontrolle schon längst passiert sein sollte (nämlich mit jedem Durchlauf von foreach
).
MfG H☼psel
--
"It's amazing I won. I was running against peace, prosperity, and incumbency."
George W. Bush speaking to Swedish Prime Minister unaware a live television camera was still rolling, June 14, 2001
Selfcode: ie:% fl:( br:> va:) ls:& fo:) rl:? n4:& ss:| de:] js:| ch:? sh:( mo:) zu:)
"It's amazing I won. I was running against peace, prosperity, and incumbency."
George W. Bush speaking to Swedish Prime Minister unaware a live television camera was still rolling, June 14, 2001
Selfcode: ie:% fl:( br:> va:) ls:& fo:) rl:? n4:& ss:| de:] js:| ch:? sh:( mo:) zu:)