title: How to run while loop maximum 5 times in php
body: <p>I have total 10 post but i want to run while loop only 5 times. and want to show only 5 values. I am very new in wordpress/php so any kind of help would be really appreciated :)</p>
  
  <p>Here is my code :</p>
  
  <pre><code>&lt;?php query_posts('page_id=4');
                      $i=0;
                      ?&gt; 
                     &lt;?php while (have_posts()) : the_post(); 
  
  if( have_rows('numbers_area') ): while ( have_rows('numbers_area') ) : the_row();
                  if( get_row_layout() == 'numbers_area' ):
  
                      ?&gt; 
  
                      &lt;div class="col-md-2 &lt;?php if ($i==0){ ?&gt; col-md-offset-1 &lt;?php } ?&gt; col-sm-6"&gt;
                          &lt;div class="facts_information facts_information_1"&gt;
                              &lt;h5&gt;&lt;span class="count"&gt;&lt;?php echo get_sub_field('numbers'); ?&gt;&lt;/span&gt;&lt;/h5&gt;
                              &lt;p&gt;&lt;?php echo get_sub_field('details'); ?&gt;&lt;/p&gt;
                              &lt;i class="&lt;?php echo get_sub_field('icon'); ?&gt;" aria-hidden="true"&gt;&lt;/i&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
  
                       &lt;?php
  
                      $i++;
  
                endif;
            endwhile;
          endif;
            endwhile;
          ?&gt;
  </code></pre>