PHP while loop

Source: Internet
Author: User

The PHP while loop executes a block of code when the specified condition is true.

PHP Loops

When you write code, you often need to run the same block of code repeatedly. Instead of adding several almost equal lines of code to the script, we can use loops to perform such tasks.

In PHP, we have the following looping statements:

  • While-loop code block whenever the specified condition is true
  • Do...while -Executes the code block first, and then repeats the loop whenever the condition is specified as True
  • for-loop code block specified number of times
  • foreach -iterates through each element in the array and loops the block of code

PHP while loop

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.