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 ove开发者_JS百科rall completed strings.
Is it possible to make something like that with output buffer?
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...
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.
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.
精彩评论