: 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.