Page 1 of 1

have php make server wait/pause/count

Posted: Fri Jun 15, 2007 9:48 pm
by afbase
Is there a way in php to make the server count/wait/pause for a given time period? For instance

Code: Select all

while ($red = "wings for life"){
/*  stuff done here */

count_time(5); //<---- that line makes php/server count 5 seconds before continuing with the script

}
Is there something like this????

quicky

Posted: Fri Jun 15, 2007 10:28 pm
by afbase
I made this script kinda on the fly. Does anyone see anything wrong with it? It runs fine for me but it just feels really shoddy:

Code: Select all

function time_diff($time_to_wait){
			$now = time();
			print date("m-d-Y G:i-s",$now);
			for($i=0; $i <= $i+1;$i++){
				$future = $now + $time_to_wait;
				if (time() == $future) break;
				$i=0;
			}
			print date("m-d-Y G:i-s",$future);
		  }
does anyone have a better idea that feels more kosher than this?

Posted: Fri Jun 15, 2007 11:23 pm
by Burrito

Posted: Fri Jun 15, 2007 11:33 pm
by afbase
friggin sweet


Burrito++;

Posted: Sat Jun 16, 2007 5:14 am
by arukomp
Also you can use usleep() to wait for microseconds