title: Why does CodeIgniter store output in a variable?
body: <p>i recently looked through CodeIgniter's code just to see how it works.  </p>
  
  <p>One thing that i don't understand is why CodeIgniter is storing all the output generated by the views in a single variable and outputting it at the end of the script?  </p>
  
  <p>Here's a piece of code from ./system/core/Loader.php at line 870<br>
  <a href="https://github.com/EllisLab/CodeIgniter/blob/1d79efea47d26e0e567f919c648adf5b554f3ff0/system/core/Loader.php#L870" rel="nofollow">CI Source code @ GitHub</a></p>
  
  <pre><code>/*
  * Flush the buffer... or buff the flusher?
  *
  * In order to permit views to be nested within
  * other views, we need to flush the content back out whenever
  * we are beyond the first level of output buffering so that
  * it can be seen and included properly by the first included
  * template and any subsequent ones. Oy!
  */
  if (ob_get_level() &gt; $this-&gt;_ci_ob_level + 1)
  {
      ob_end_flush();
  }
  else
  {
      $_ci_CI-&gt;output-&gt;append_output(ob_get_contents());
      @ob_end_clean();
  }
  </code></pre>
  
  <p>The function append_output appends the given string to a variable in the CI_Output class.<br>
  Is there a particular reason for doing this and not using echo statements or is it just a personal preference ?</p>