PHP study notes (03) -- control structure

Source: Internet
Author: User
: This article mainly introduces the control structure of PHP learning notes (03). For more information about PHP tutorials, see. Control Structure


  For ($ I = 1; $ I <10; $ I ++) {if ($ I = 4) {continue; // skip the next step and continueLoop} Echo $ I; echo"
";}For ($ I = 1; $ I <10; $ I ++) {if ($ I = 7) {echo $ I," zhenma "; break; // you have found the desired one and jumped out.Loop} Echo $ I; echo"
";}?>

Actual training

Bridge Problems


  = 5000;) {$ cnt + = 1; // deduction if ($ I> 50000) {$ I * = 0.95;} else {$ I-= 5000 ;} echo 'quarter ', $ cnt,' Cross Bridge, remaining ', $ I,' yuan
';}?>

Chicken purchases

For ($ x = 1; $ x <20; $ x ++) {for ($ y = 1; $ y <100; $ y ++) {$ z = 100-$ x-$ y; if ($ x + $ y + $ z) = 100 & (5 * $ x + 3 * $ y + (1/3) * $ z) = 100) {echo 'Rooster: ', $ x ,'
'; Echo 'hen:', $ y ,'
'; Echo 'chicken:', $ z ,'
';}}}

'). AddClass ('pre-numbering '). hide (); $ (this ). addClass ('Has-numbering '). parent (). append ($ numbering); for (I = 1; I <= lines; I ++) {$ numbering. append ($ ('
  • '). Text (I) ;}; $ numbering. fadeIn (1700) ;}) ;}; script

    The above introduces the PHP study notes (03)-control structure, including the Loop content, and hope to be helpful to friends who are interested in PHP tutorials.

    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.