Process control if ---- else

Process control:
to process PHP program execution control!
What PHP program execution means of control!
First, the execution order of
top-down execution can! This is not to perform process control!
Second, the branch execution
branch execution can be selected according to the code to perform certain conditions are met, the branch execution PHP primarily be achieved in two statements (if, switch)!
1.if statement
Note: Our code expression if statement is controlled, it is best enclosed in braces, even if it is also a statement enclosed in braces!
if statements can be nested, which is based on the actual demand!
1) one-way condition
if (expression) statement 1;
expression evaluates to true then the statement is executed 1, or do not perform!
Pass = 60 $;
$ A = 40;
IF ($ A> = $ Pass) {
echo 'Congratulations, the pass';
echo 'dwqdwqdq';
// various other statements .......!
}
Echo 'end code execution! ';
2) the condition bi
$ 60 = Pass;
$ A = 40;
IF ($ A> = $ Pass) {
echo' Congratulations! Examination by it! ';
// .......
} the else {
echo' I'm sorry, your account does not pass! ';
// .......
}
3) multidirectional condition
$ A = 84;
$ grade1 = 60; // less than 60 failed
$ grade2 = 75; // pass
$ grade3 = 85; // good
IF (A $ <$ grade1) {
echo ' fail ';
} ELSEIF (a $ <$ grade2) {
echo' you pass a shoes ';
} ELSEIF (a $ <$ grade3) {
echo' good! ';
} The else {
echo' excellent ';
}

Guess you like

Origin www.cnblogs.com/xiaowie/p/11540269.html