note 15358 added to function.flush
| From: | dave dot bonora at frogdesign dot com | Date: | Thu, 06 Sep 2001 16:50:36 +0000 |
| Subject: | note 15358 added to function.flush | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-17733@lists.php.net to get a copy of this message | ||
Here's a little utility function that wraps printf and forces IE to flush its buffer by making
the output 256 bytes long (pads with spaces).
<?
// function: ubprintf ('unbuffered printf')
// the C prototype of this function would be:
// void ubprintf(const char *format, ...);
function ubprintf() {
$args = func_get_args();
eval("printf(\"% 256s\", sprintf(\"" . implode("\",
\"", $args) . "\"));");
flush();
}
// useage example
ubprintf("Testing...");
sleep(2);
for ($i = 1; $i <= 3; $i++) {
ubprintf("%d...", $i);
sleep(2);
}
?>
http://www.php.net/manual/en/function.flush.php