Tuesday, 1 December 2015

how to skip first five loops from foreach in php

Start a counter and use continue keyword to skip the first 5 loops:
*******************************************************
$counter = 0 ;
foreach($data as $info) {
    if($counter++ < 10) continue ;
    // Loop code
}
*******************************************************

No comments:

Post a Comment