gple Posted May 26, 2007 Share Posted May 26, 2007 Is there any way to pause inside a loop? If I want to pause for 1 second between each output, is that possible Quote Link to comment https://forums.phpfreaks.com/topic/53050-pausing-script/ Share on other sites More sharing options...
taith Posted May 26, 2007 Share Posted May 26, 2007 sleep(1); Quote Link to comment https://forums.phpfreaks.com/topic/53050-pausing-script/#findComment-262058 Share on other sites More sharing options...
AndyB Posted May 26, 2007 Share Posted May 26, 2007 sleep() pauses execution of a script. If you want to pause output to the browser, you need something like: <?php ob_start(); for ($i=1;$i<10;$i++) { echo $i. "<br/>"; sleep(1); // pause 1 second ob_flush(); flush(); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/53050-pausing-script/#findComment-262059 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.