0

I've created this code and it shows next integer every second but there are also errors along with the output.

<?php

ob_implicit_flush();
for ($i = 0; $i < 30; $i++) {
  echo "-> $i <br>\n";
  ob_end_flush();
  ob_end_clean();
  sleep(1);
}

?>

error:

Notice: ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flush in c:\apache\www\TEST.PHP on line 6
Notice: ob_end_clean(): failed to delete buffer. No buffer to delete in C:\apache\www\TEST.PHP on line 7
-> 4

Putting @ sign on the ob_* functions to silence these errors also disables realtime output.

rsk82
  • 28,217
  • 50
  • 150
  • 240

1 Answers1

0

You are ending ob_end_flush();

You should use only this:

ob_flush();
SniperCoder
  • 823
  • 2
  • 11
  • 23