Re: pause_script($int)??
| From: | Stephan Seidt | Date: | Sat, 01 Feb 2003 13:47:11 +0000 |
| Subject: | Re: pause_script($int)?? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-133880@lists.php.net to get a copy of this message | ||
what about sleep() ?
OjMyStEr wrote:
Hi, Does anyone know if there is a way for me to produce a function in PHP to pause the processing of the script for 3 seconds for example without eating up the CPU bandwidth. I could do with quite accurate control. Is there a better way that doing it like this: <?php function pause_script($int){ $start_time = time(); while(time() <= ($start_time+$int)){-- IPv6 + TCPA + wrecked Palladium server = NO COFFE!// No functions take place inside the loop!} } echo "The current time is " . time() . "\n"; pause_script(10); echo "The current time is " . time() . "\n"; ?> The output is: The current time is 1044105730 The current time is 1044105741 There is obviously an 11 second difference is the time that the two seperate lines were printed. Thing is, when I run this script the CPU usage goes to 100% Anyone got any ideas? Thanx Josh