Jump to content


Photo

for and while loops


  • Please log in to reply
4 replies to this topic

#1 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 17 April 2006 - 08:58 PM

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.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#2 katocan

katocan
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 17 April 2006 - 09:00 PM

Well you could crash someones browser.

#3 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 17 April 2006 - 09:12 PM

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.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#4 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 17 April 2006 - 09:16 PM

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
follow me on twitter @PHPsycho

#5 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 17 April 2006 - 09:27 PM

thank you for the answer, that helped.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users