tags:

views:

50

answers:

3

For example i'm looping through a big file, and after counter reaches 1000 parsed strings i need to echo message, that 1000 string have been parsed and calculate % of overall completed strings.

Is it possible to make something like that with output buffer?

+5  A: 

Take a look at flush(). Whether or not your browser will render the incomplete page, or wait till it finishes loading is entirely implementation-dependent, though...

Faisal
A: 

One possiblity is to use another script to output the progress, and have the client poll it in set intervals for current progress, and only ask for the complete output after the whole process is complete.

nikc
+1  A: 

Make your script to write the progress data in a text file on the server. Now program your webpage with help of Ajax to send request to that file in particular intervals of time. Get the data and calculate the percentage and modify the HTML of your page.

Shubham