Forum Moderators: coopster

Message Too Old, No Replies

Timer in PHP

Timer

         

balimiusha

12:05 pm on Jan 8, 2004 (gmt 0)



Hello All, is there anything like Timer function in PHP, as there's in VB. What I want is, I want to call a function(or display time) at intervals say for every 10 secs.

Thanks

dcrombie

1:49 pm on Jan 8, 2004 (gmt 0)



PHP is a server-side language. That means that any functions on your page are ONLY called at the time the page is requested from the server.

kazonik

1:57 pm on Jan 8, 2004 (gmt 0)

10+ Year Member



can you be a little more specific please?

do you want your script to run at a certain time? say every $x minutes? If this is what your after you probably want to use something like "cron"

or

do you want to call the script from you browser and do something every $x seconds? If you want to send info to the browser at a set interval you could try something like..

<?
while( $x < 5)
{
sleep(10); #10 is the number of seconds to wait
echo 'the time is ';
echo date("Y-m-d h:i s");
$x++;
}
?>

shrirch

2:13 pm on Jan 8, 2004 (gmt 0)

10+ Year Member



PHP is not a message based language, so windows type timer calls which normally result in a windows message being queued up don't work.

If you're looking for a pause and resume type function look at

[php.net...]