Why ob_start() solves the header() error?
<p>I have a script that has a call to <code>header();</code> and its working fine for a couple of days since I first started running the script.</p>

<p>then after a couple of days, it started to have an error saying it cannot modify header information.</p>

<p>Then I put <code>ob_start();</code> and <code>ob_end_flush();</code> upon googling the error and it works!</p>

<p>The error has gone but my question is that why it works without <code>ob_start();</code> and <code>ob_end_flush();</code> for a couple of days before?</p>

<p>I want to know the explanation behind this behavior.</p>

<p>btw, I call <code>header()</code> this way:</p>

<pre><code>if(condition is true){
header('Location: anotherpage.php');
}
</code></pre>

<p>and I have a <code>session_start();</code> at the beginning.</p>
