Programming Basics

  Home arrow Programming Basics arrow Page 5 - Looping in PHP
PROGRAMMING BASICS

Looping in PHP
By: bluephoenix
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 4
    2004-08-19

    Table of Contents:
  • Looping in PHP
  • While Loops
  • Do-While Loops
  • For Loops
  • Conclusion

  •  
     

    SEARCH CODEWALKERS

    TOOLS YOU CAN USE

    advertisement

    Looping in PHP - Conclusion


    (Page 5 of 5 )

    This tutorial highlighted 3 different constructs you can use in your PHP scripts to repeat a block of code: while loops, do-while loops and for loops.

    The for loop can be used in a restrictive "counter" type situation. The while loop can be used in a situation where a section of given code may or may not be processed depending on a condition. The do-while loop can be used when a section of code must be executed at least once but future loops are then dependent on the conditional expression.

    When writing loop statements it's imperative to pay attention to how the variables are set and the escape conditional statement reads. Logic errors and typos can cause a loop to repeat indefinitely!

    ...And this concludes the tutorial; all this talk of donuts has made me hungry!

    About The Author

    Timothy Boronczyk lives in Syracuse, NY, where he works as an E-Services Coordinator for a local credit union. He has a background in elementary education, over 5 years experience in web design and has written tutorials on web design, PHP, Ruby, XML and various other topics. His hobbies include photography and composing music.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.
    blog comments powered by Disqus

    PROGRAMMING BASICS ARTICLES

    - Control Flow Constructs
    - More Time Manipulation with PHP
    - Validating and Manipulating Dates with PHP
    - Using the Date Constructor in PHP
    - Calendar Construction with PHP
    - PHP`s Calendar Package
    - Getting Modified Versions and Correct Dates ...
    - Combining Date Functions in PHP
    - Using PHP for Date and Time in Programming
    - More Exception Handling with PHP
    - Exception Handling in PHP
    - Error Logging and Handling Exceptions
    - Configuration Directives for Error and Excep...
    - Error and Exception Handling
    - Python Modules for Games


    © 2003-2012 by Developer Shed. All rights reserved. DS Cluster 9 - Follow our Sitemap