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.

3

1 Answer 1

0

You are ending ob_end_flush();

You should use only this:

ob_flush();
Sign up to request clarification or add additional context in comments.

1 Comment

with ob_flush(); it also doesn't work, output is buffered as usual.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.