Now the image output is carried out using the counter in 3 intervals:

0-73 73-88 88-141 

Question: How to remove the image output using the counter in the range of 0-73?

 $name = glob('./album/*.{php}', GLOB_BRACE); $counter = 0; //заводим счетчик for($i=0; $i<=(sizeof($name)-1); $i++) { if( substr($name[$i][2],0,1) != "_") { echo "<li><img src='".$dir."img/_share/".$shortname."_1.jpg' height='162px'></li>"; $counter++; if ($counter == 73) { echo "<li><img src='".$dir."img/_share/".$shortname."_1.jpg' height='162px'></li>"; } elseif ($counter == 88) { require_once "ddd.php"; } elseif ($counter == 141) { break; } } } 

    1 answer 1

    Use continue :

     $counter = 0; //заводим счетчик for ( $i = 0; $i <= ( sizeof( $name ) - 1 ); $i++ ) { if ( substr( $name[ $i ][ 2 ], 0, 1 ) != "_" ) { $counter++; /*Условие */ if($counter < 73){ continue; } echo "<li><img src='" . $dir . "img/_share/" . $shortname . "_1.jpg' height='162px'></li>"; if ( $counter == 73 ) { echo "<li><img src='" . $dir . "img/_share/" . $shortname . "_1.jpg' height='162px'></li>"; } elseif ( $counter == 88 ) { require_once "ddd.php"; } elseif ( $counter == 141 ) { break; } } }