Skip to content

Instantly share code, notes, and snippets.

@gorillamoe
Last active January 4, 2016 05:29
Show Gist options
  • Save gorillamoe/8575579 to your computer and use it in GitHub Desktop.
Save gorillamoe/8575579 to your computer and use it in GitHub Desktop.
PHP echo out immediately.
<?php
// quick hack, because many browsers need a certain amount of body size
// to be printed in the first place before flush will have an effect
while (ob_get_level()) ob_end_flush();
// implicit flush, so we don't have to call flush all the time
ob_implicit_flush(true);
for ( $i = 0; $i < 113377; $i++ ) {
// gets immediately echo'd out
echo "this is $i\n\n";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment