Phpcontinue differs from other languages

Source: Internet
Author: User
Switch, while, and so on are all very common PHP loops, which can be used well. It is very good for PHP programs with strong logic. Break is a jump out loop, while continue is the next loop. There are many things in the manual. The most important thing is how to apply them to practice. The following are the extracted parts of the continue in

Switch, while, and so on are all very common PHP loops, which can be used well. It is very good for PHP programs with strong logic. Break is a jump out loop, while continue is the next loop. There are many things in the manual. The most important thing is how to apply them to practice. The following are the extracted parts of the continue in

Switch, while, and so on are all very common PHP loops, which can be used well. It is very good for PHP programs with strong logic. Break is a jump out loop, while continue is the next loop. There are many things in the manual. The most important thing is how to apply them to practice.

The following are excerpted parts

Continue is used in the loop structure to skip the remaining code in this loop and start to execute the next loop when the condition value is true. Continue accepts an optional numeric parameter to decide to skip multiple cycles to the end of the loop.

 \n"; while (1) { echo "  Middle
\n"; while (1) { echo " Inner
\n"; continue 3; } echo "This never gets output.
\n"; } echo "Neither does this.
\n"; } ?>

Omitting the semicolon after the continue will lead to confusion. The following example shows that you should not do this.

 


The expected result is:

0 1 3 4

The actual output is: 2.

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.