note 15358 deleted from function.flush by jimw
| From: | jimw@php.net | Date: | Mon, 05 Nov 2001 20:59:47 +0000 |
| Subject: | note 15358 deleted from function.flush by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-20497@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);
}
?>