Hopsel: foreach nach bestimmter anzahl beenden

Beitrag lesen

Hi jobo!

Der Ansatz ist richtig.

Ist er nicht...

Richtig wäre folgender Ansatz:

$count = 5;  
foreach(...)  
{  
  // ...  
  
  if(!(--$count))  
    break;  
}

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:)