Q:

Limit loop for display carausel in slide?

The source of html http://bootsnipp.com/snippets/featured/simple-carousel
And Here is my code to display thumbnail 6 items per page carousel within php for loop.
<div id="Carousel" class="carousel slide">
            <!-- Carousel items -->
                <div class="carousel-inner">     
                     <?php 
                        $arr = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
                    ?>

                    <?php 
                      echo "<div class='item active'>";
                      echo "<div class='row'>";
                        foreach($arr as $key=>$value)
                        {
                            //if we can divide $key by six without remainder

                            if ($key % 6 == 0) 
                            {
                                echo "</div>";
                                echo "</div>";
                                echo "<div class='item'>";
                                echo "<div class='row'>";
                            }
                            echo "<div class='col-md-2'>";
                            echo '<a href="#" class="thumbnail" id="carousel-selector-'.$key.'"><img src="images/img'.$value.'.jpg" alt="Image" style="max-width:100%;"></a>';
                            echo "</div>";
                        }
                    echo "</div>";  
                    echo "</div>";?>    

                </div><!--.carousel-inner-->
              <a data-slide="prev" href="#Carousel" class="left carousel-control">‹</a>
              <a data-slide="next" href="#Carousel" class="right carousel-control">›</a>
            </div><!--.Carousel-->

why the first 6 items not appear, but 6 items second page come appear.
what do I missed?
Thanks

A:

if ($key % 6 == 0 AND $key!=0) 

