Home >Backend Development >PHP Tutorial >Conditional statements written with && php - three types of conditional statements
First type: IF conditional statement
Second type: ternary operation
Third type: conditional statement composed of && and ||
First type: IF Needless to say, this is the basis, I believe most of them Everyone knows it;
Second type: c=a>b ? true:false //Means: If a>b is true, return true, otherwise return false (of course it can be replaced with a statement), and return the result to c ;
Third type: 1, &&
if ($a>0 && $b>0){ //语句; }
}
When the condition is true, the statements in it will be executed; but it is too troublesome to write like this. We can write directly like this:
The computer will first determine whether $a is true. If so, the following statements will be executed. If not, there is no need to execute the following statements;
The computer first determines whether $a >0 is true, yes: the following statements will not be executed, no: they will be executed;
Copyright Statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission.
The above introduces the three conditional statements written in && PHP, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.