Home >Backend Development >PHP Tutorial >PHP_Class Summary Notes 0614
Sequential control statements (branch control (if; switch); loop control (for; while)); break; continue; goto; variables; constants; functions
if branch control (branch is in several ranges time)
Single branch: if(..){..};
Double branch: if(..){..}else{..}
Multiple branches: if(. .){..}else if(..){..}else if(..){..}
switch branch statement (when the branch is several points)
switch(expression ){
case constant1:
//nmulti-statement;
break;
case constant2:
//nMultiple statements
break;
defual:
//nMultiple statements;
break;
}
for loop control
for(initial value of loop ;conditions for looping ;step size){
//nMultiple statements;
}
while loop statement
while(loop condition){
//Loop body,statement
}
break
break defaults to jumping out of 1 layer, followed by the number n, break n can specify n layers to jump out of, but n cannot exceed the actual jump out The number of loop levels, otherwise a fatal error will be reported
continue
conitnue is used to end the remaining code of this loop and start a new loop from scratch (if the condition is true, continue execution), continue can also be followed by a number , indicating the number of cycles to restart from
goto
Through the goto statement, we can jump the program to the specified place for execution
goto tag;
Quick Start Case 2
for($i =0,$j=50; $i<100; $i++) {
while($j--) {
if($j==17) goto end;
}
}
echo " i = $i";
end:
echo 'j = 17 '.$i."||".$j;
result:
j = 17
The above has introduced PHP_Class Summary Notes 0614, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.