tmartin314 tmartin314 - 18 days ago 4x
PHP Question

Getting foreach to skip over iterations

I basically need something inside a foreach loop that will skip over the first 10 iterations of the array.

foreach($aSubs as $aSub){
if($iStart > '0')
//Skip first $iStart iterations. Start at the next one


Gus Gus

Start a counter and use continue to skip the first ten loops:

$counter = 0 ;
foreach($aSubs as $aSub) {
    if($counter++ < 10) continue ;
    // Loop code