title: echo after loop finishes rather than while looping
body: <p>I am coding my own forums (for learning reasons) and am trying to find a solution to the following:</p>
  
  <p>I have forum posts stored in the database and when I want to display these posts, I first put each post from mySQL into an array ($posts[][]) then loop through these arrays to output them onto the htmlpage:</p>
  
  <pre><code>if (count($posts) &gt; 0) {
      for ($x = 0; $x &lt; count($posts); $x++) {
          echo '
          &lt;div class="post-header"&gt;' . $posts[$x][3] . '&lt;text style="float:right"&gt;#' . ($x+1) . '&lt;/text&gt;&lt;/div&gt;
          &lt;div class="post"&gt;
              &lt;div class="post-user "&gt;';
              if(login_check($mysqli) &amp;&amp; (permission_check($mysqli) == 2 || permission_check($mysqli) == 3 || $username == $posts[$x][5])) {
                  echo '&lt;a href="posting.php?topicID='. $topicID . '&amp;forumID=' . $forumID . '&amp;postID=' . $posts[$x][1] . '&amp;mode=edit"&gt;Edit&lt;/a&gt;&lt;br&gt;';
              }
              echo '&lt;a href="../profile/?profile="' . $posts[$x][5] . '"&gt;' . $posts[$x][5] . '&lt;/a&gt;
              &lt;br&gt;
              &lt;/div&gt;
              &lt;div class="post-text"&gt;' . $bbcode-&gt;parse($posts[$x][4]) . '&lt;/div&gt;
          &lt;/div&gt;&lt;br&gt;';
      }
  }
  </code></pre>
  
  <p>Whilst this runs perfectly fine I wish for the echo to only display after the loop finishes. At the moment this echos in real time and each forum post gets  added in to the html until the loop finishes, which looks like it is loading very slowly.</p>