Joe
Joe

Reputation: 3089

php - output echo'd contents in browser while script is running?

Does anyone know how to output stuff I echo to a browser while the script is running?

I have a long loop that I'd like to output a string after every run of the loop, kind of like a progress bar, does anyone know how to do that?

Upvotes: 2

Views: 3564

Answers (1)

Jacob Relkin
Jacob Relkin

Reputation: 163228

Use the ob_flush() function:

ob_start();
//echo stuff...

ob_flush();

//echo more stuff...

ob_flush();

Upvotes: 4

Related Questions