mraza Posted December 1, 2009 Share Posted December 1, 2009 hi ! is it possible if i have a loop like below, lets say if it runs one time then it will wait for one minute and then continue. : for ($i=0;$i<10;$i++){ //statments echo $i; } means on first it will give out put 0 then wait for one minute then output 1 then wait one minute again and output 2 so on... maybe stupid question but ... Thanks for the support Quote Link to comment https://forums.phpfreaks.com/topic/183652-loop-timing/ Share on other sites More sharing options...
mikesta707 Posted December 1, 2009 Share Posted December 1, 2009 You can use php's sleep() function. 1 minute is a little long though, and you could end up DDOSing your own server if you have this on a page that a lot of people visit Quote Link to comment https://forums.phpfreaks.com/topic/183652-loop-timing/#findComment-969319 Share on other sites More sharing options...
mraza Posted December 1, 2009 Author Share Posted December 1, 2009 Thanks so its useless for me it could use too much resources but what if i use only i visit and use that script? Regards Quote Link to comment https://forums.phpfreaks.com/topic/183652-loop-timing/#findComment-969322 Share on other sites More sharing options...
mikesta707 Posted December 1, 2009 Share Posted December 1, 2009 If you are the only one that visits that page, then I guess it would be OK. Why do you want to make the server sleep for a minute tho? I can't really think of a reason that this would be beneficial Quote Link to comment https://forums.phpfreaks.com/topic/183652-loop-timing/#findComment-969337 Share on other sites More sharing options...
mraza Posted December 1, 2009 Author Share Posted December 1, 2009 nothing special just was curious what can't be done with PHP.. Regards Quote Link to comment https://forums.phpfreaks.com/topic/183652-loop-timing/#findComment-969346 Share on other sites More sharing options...
Daniel0 Posted December 1, 2009 Share Posted December 1, 2009 If you are the only one that visits that page, then I guess it would be OK. PHP scripts needn't necessarily be run through a web server. Quote Link to comment https://forums.phpfreaks.com/topic/183652-loop-timing/#findComment-969361 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.