note 95164 added to function.sleep
| From: | mohd at Bahrain dot Bz | Date: | Wed, 16 Dec 2009 09:12:36 +0000 |
| Subject: | note 95164 added to function.sleep | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-164039@lists.php.net to get a copy of this message | ||
I hope this code will help somebody to solve the problem of not being able to flush or output the
buffer to the browser (I use IE7).
It may work for you with just [ echo str_repeat(".", 4096); ] and without even using
ob_... and flush.
<?php
ob_start();
ob_implicit_flush(true);
//[ OR ] echo "..."; ob_flush(); flush();
set_time_limit(0);
function sleep_echo($secs) {
$secs = (int) $secs;
$buffer = str_repeat(".", 4096);
//echo $buffer."\r\n<br />\r\n";
for ($i=0; $i<$secs; $i++) {
echo date("H:i:s", time())." (".($i+1).")"."\r\n<br
/>\r\n".$buffer."\r\n<br />\r\n";
ob_flush();
flush();
sleep(1);
//usleep(1000000);
}
}
sleep_echo(30);
ob_end_flush();
?>
----
Server IP: 64.71.164.2
Probable Submitter: 96.30.31.76
----
Manual Page -- http://www.php.net/manual/en/function.sleep.php
Edit -- https://master.php.net/note/edit/95164
Del: integrated -- https://master.php.net/note/delete/95164/integrated
Del: useless -- https://master.php.net/note/delete/95164/useless
Del: bad code -- https://master.php.net/note/delete/95164/bad+code
Del: spam -- https://master.php.net/note/delete/95164/spam
Del: non-english -- https://master.php.net/note/delete/95164/non-english
Del: in docs -- https://master.php.net/note/delete/95164/in+docs
Del: other reasons-- https://master.php.net/note/delete/95164
Reject -- https://master.php.net/note/reject/95164
Search -- https://master.php.net/manage/user-notes.php