Re: timer in php-cli
| From: | Aidan Lister | Date: | Tue, 02 Mar 2004 03:06:31 +0000 |
| Subject: | Re: timer in php-cli | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-179200@lists.php.net to get a copy of this message | ||
A simple timer:
<?
$length = 10;
$timestart = time();
for (;;)
{
if (time() = $timestart + 10)
{
// go
}
}
?>
Also, you should look at the PEAR::Net_SmartIRC framework (it has timers
already). It's a fantastic framework, and there's really no point in
re-writing the textbook.
http://pear.php.net/package/Net_SmartIRC
-- aidan
"Nobody" <dlh@campus-bg.com> wrote in message
news:40435E4D.000006.02872@DLH...
> Hello,
>
> I'm writing a php irc bot. I've come up to the situation where I need a
> timer for processing different data in a "special" way. I've searched the
> archive of the list but I didn't found nothing helpful (I can't use
> JavaScript here, neither cron).
> If I use for(;;) or sleep(); the whole script stops (php is not
> multithread:(). Eventually I've come up with some ideas about ticks, but
> didn't get to finished it my head. So, any ideas?
>
> And is php5 going to be multithreaded? If not, when?:)
>
> --
> best wishes,
> Strahil Minev,
> http://sourceforge.net/users/phuncky/