Help - Search - Members - Calendar
Full Version: PHP Timer
Invision Power Services > Community Forums > Community Web Design and Coding
Michael Boutros
In my script, I want it to print out the words "Hello World" 40 times, once every 20 seconds. How would I go along doing this?
_
CODE
for($a = 0; $a < 40; $a++)
{
        echo "Hello World";
        sleep(20);
}


That should do, but you'll need to bypass max_execution_time.
However, it won't display anything until execution is over. I believe that's unbypassable.
phatmonkey
CODE
for($a = 0; $a < 40; $a++)
{
         echo "Hello World";
flush();
         sleep(20);
}
_
Hey, that's cool! original.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.