note 36972 deleted from function.flush by didou
| From: | didou@php.net | Date: | Wed, 29 Oct 2003 12:26:56 +0000 |
| Subject: | note 36972 deleted from function.flush by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-59469@lists.php.net to get a copy of this message | ||
Note Submitter: m@rco
----
in order to display in HTML pages something like a "progress bar" or if you want to force
the web server to flush output to the browser, or the browser to flush as well, you can print a long
enough "dummy" string to make the output buffer grow, as you probably know, like:
print "[";
for($i = 0; $i < 100; $i++){
$spaces.=" ";
} // for
//and then
for($i = 0; $i < 10; $i++){
for($ii = 0; $ii < 200000; $ii++){
//do something slow here
} // for
print "$spaces|";
flush();
} // for
print "]";
/*
but this somethin may be not really what you expect in
a progress bar, as it prints spaces (although rendered as single by the browser) between the bar
units..
you can solve this using
$spaces.="<!-- bufferme -->";
/*
print "[";
for($i = 0; $i < 100; $i++){
$spaces.="<!-- bufferme -->";
} // for
//and then
for($i = 0; $i < 10; $i++){
for($ii = 0; $ii < 200000; $ii++){
//do something slow here
} // for
print "$spaces|";
flush();
} // for
print "]";
//which looks nice as a progress bar..