note 24529 modified in function.time by jmcastagnetto
| From: | jmcastagnetto@php.net | Date: | Tue, 20 Aug 2002 22:49:41 +0000 |
| Subject: | note 24529 modified in function.time by jmcastagnetto | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-35276@lists.php.net to get a copy of this message | ||
[Editor's note: the contributor to the note did not know of the sleep() and usleep() functions
that already do the job for you.]
If you want to have your program
wait for a period of seconds.
//arg is the number of seconds to wait
function wait($arg)
{
$then = time() + $arg;
//echo "then=" . $then . "<br>\n";
while(1)
{
$now = time();
//echo "now=" . $now . "<br>\n";
if($now > $then)
return;
}
}
wait(3);
--was--
If you want to have your program
wait for a period of seconds.
//arg is the number of seconds to wait
function wait($arg)
{
$then = time() + $arg;
//echo "then=" . $then . "<br>\n";
while(1)
{
$now = time();
//echo "now=" . $now . "<br>\n";
if($now > $then)
return;
}
}
wait(3);
http://www.php.net/manual/en/function.time.php