Skip to content

Instantly share code, notes, and snippets.

@ghacosta
Last active January 14, 2016 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ghacosta/732a6b51a05d634b15b2 to your computer and use it in GitHub Desktop.
Save ghacosta/732a6b51a05d634b15b2 to your computer and use it in GitHub Desktop.
enabling echo in real time flushing buffer.
<?php
// Turn off output buffering
ini_set('output_buffering', 'off');
// Turn off PHP output compression
ini_set('zlib.output_compression', false);
//Flush (send) the output buffer and turn off output buffering
while(@ob_end_flush());
// Implicitly flush the buffer(s)
ini_set('implicit_flush', true);
ob_implicit_flush(true);
// Needed to force browsers to actually display data
echo str_pad("",1024," ");
echo "<br />";
ob_implicit_flush(true);
for($i=1; $i<=10; $i++){
//if wants to clear screen
//ob_end_clean();
echo "$i ...<br>";
sleep(1);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment