pause_script($int)??

From: Date: Sat, 01 Feb 2003 13:34:22 +0000
Subject: pause_script($int)??
Groups: php.general 
Request: Send a blank email to php-general+get-133877@lists.php.net to get a copy of this message
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)){ // 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

« previous php.general (#133877) next »