Jump to content

Archived

This topic is now archived and is closed to further replies.

Ninjakreborn

for and while loops

Recommended Posts

I have been playing with these, I can get the browser to create something over and over again and never stop, like have it say something for eternity, in what possible situations could an infinite while loop end up being effective, i can think of some small samples, but is there a few major samples anyone can give me to understand the effectiveness of these, I heard these also have there purposes in certain situations.

Share this post


Link to post
Share on other sites
I am meaning what are the uses of the while loop, and for loop, I know in major programs they can be of great helped, under heavily controlled situations. For instance, in a major forum program, would you ever need an infinite loop to do something specific, if so what, or are infinite loops completely uses on all levels when speaking about php, I know with javascript they are very helpful for instance, if you want scrolling text then you set an infinite loop to allow the text to scroll forever at a timed interval setting, also pictures, you want a gallery that cycles through all pictures in the file, you set an infinite loop, just under a specific guided speed, and with people having the ability to break the loop, by selecting buttons to go on there own pace, so I know it has good uses in javascript, but now what about php, what major purposes are they for.

Share this post


Link to post
Share on other sites
well...

infinite loops on a standard page served to a browser will normally time out ater 30s of script parsing (thats the default in the ini file which can be changed - but people don't wait 30 s for a [age anymore!!!!)

you can however use them in cron jobs that run in the background on the server for 'constant' data processing, i.e. stockmarket figures

others will ,I'm sure, give further examples

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.