View previous topic :: View next topic |
Author |
Message |
PaulK -
Joined: 26 Apr 2006 Posts: 132 Location: London, UK
|
Posted: Fri Oct 06, 2006 2:52 pm Post subject: time delay in php |
|
|
Is there a command for making php wait for set number ot seconds/minutes?
I tried php.net and did a scan for wait and puase as commands but couldnt find aything useful.
Thanks guys
Paul |
|
Back to top |
|
 |
cmxflash -
Joined: 11 Dec 2004 Posts: 872
|
Posted: Fri Oct 06, 2006 3:01 pm Post subject: |
|
|
Use sleep() to make it stop for N seconds. Use usleep() to make it stop for N milliseconds.
Code: |
<?php
//Sleep for three seconds
sleep(3);
//Sleep another three seconds
usleep(3000000);
//Try outputting some data
echo "Hello ";
//Send the text to the client
flush();
ob_flush();
sleep(2);
//Output "world!" two seconds after "hello".
echo "world!";
?> |
|
|
Back to top |
|
 |
PaulK -
Joined: 26 Apr 2006 Posts: 132 Location: London, UK
|
Posted: Fri Oct 06, 2006 3:29 pm Post subject: |
|
|
ahhh sleep!!! *slaps forehead* thank you, just want I was after!
Paul |
|
Back to top |
|
 |
|