Show results while script is still executing

Guys,

Would you like to see results while script still executing..??

good..try the below code..i tested this and its working perfect..finally understood output buffering a bit 😉

<?php

if (ob_get_level() == 0) ob_start();

for ($i = 0; $i<10; $i++){

echo “<br> Line to show.”;

//echo str_pad(”,4096).”\n”;

ob_flush();
flush();
sleep(1);

}

echo “Done.”;

ob_end_flush();

?>

Advertisements