note 85353 added to function.sleep
| From: | webseos at gmail dot com | Date: | Wed, 27 Aug 2008 04:29:15 +0000 |
| Subject: | note 85353 added to function.sleep | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-143857@lists.php.net to get a copy of this message | ||
This is a critical thing to use time delay function as sleep() Because a beginner can find that this
is not working and he/she will see that all output appearing at a time.
A good way to implement this is by using the function - ob_implicit_flush() then you don't
need to use flush() function explicitly.
A sample code :
<?php
ob_implicit_flush(true);
for($i=0;$i<5;$i++)
{
$dis=<<<DIS
<div style="width:200px; background-color:lime;border:1px;
text-align:center;text-decoration:blink;">
$i
</div>
DIS;
echo $dis;
sleep(5);
//flush();
}
----
Server IP: 203.199.69.133
Probable Submitter: 117.99.30.114
----
Manual Page -- http://www.php.net/manual/en/function.sleep.php
Edit -- https://master.php.net/note/edit/85353
Del: integrated -- https://master.php.net/note/delete/85353/integrated
Del: useless -- https://master.php.net/note/delete/85353/useless
Del: bad code -- https://master.php.net/note/delete/85353/bad+code
Del: spam -- https://master.php.net/note/delete/85353/spam
Del: non-english -- https://master.php.net/note/delete/85353/non-english
Del: in docs -- https://master.php.net/note/delete/85353/in+docs
Del: other reasons-- https://master.php.net/note/delete/85353
Reject -- https://master.php.net/note/reject/85353
Search -- https://master.php.net/manage/user-notes.php