clock countdown in php?

  • Thread starter Thread starter josen
  • Start date Start date
J

josen

Guest
im looking for a code in php i have not been able to find it anywere
im looking for something like this ,

count down script,
if count down = 0
then " comand "
else

simple code but has been driving me crazy
 
I'm not sure what a countdown would do for you in php. You could use either the sleep() command (which words as sleep($number of seconds)) which pauses the code until the time has elapsed, but also a for cycle in case you want to execute stuff before the time has elapsed:

for($i=0;$i<$maxsecondstime;$i++) {
//code to do goes here
sleep(1);//pause for a second
}

//code to do when countdown has elapsed goes here.

Thing is, PHP is a server-side language and the point is to make it work faster, not slower - since it's activity is invisible to the visitor, he only sees the final result anyway. In order to have a clock countdown to do something for web visitors, I think you need some Javascript.
 
Back
Top