Echo string dynamically in while loop
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/2832010/what-is-output-buffering">what is output buffering?</a><br>
  <a href="http://stackoverflow.com/questions/11544714/why-does-php-send-it-all-at-once">Why does PHP send it all at once?</a>  </p>
</blockquote>



<p>I want to echo "sent" dynamically when sending emails from list. My script only echos after it finishes all. How can I echo string dynamically in while loop ?</p>

<pre><code>$f=fopen("list.txt","r");

if($f){

    while (!feof($f)) {

        $line = fgets($f, 4096);

        $lncount++;

        $val = $lines[$lncount];

        mailsender($line,$yollayan,$sifresi,$name);

        echo "sent";

    }
}
</code></pre>
