亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

PHP if...else...elseif statement

English explanation:

##*if * Pronunciation: [?f]

Chinese explanation: if

else Pronunciation: [?ls]

Chinese explanation: Otherwise


##PHP conditional statement

When you write code, you often want to perform different actions for different decisions. You can do this using conditional statements in your code.


In PHP, we can use the following conditional statements:

· if statement - If the specified condition is true, the code is executed

· if ...else statement - if the condition is true, execute the code; if the condition is false, execute the other end of the code

· if...elseif....else statement - select one of several code blocks To execute

· switch statement - statement one of multiple code blocks to execute


PHP - if statement

if statement is used to specify a condition Execute code when true.

Syntax

##if(

Condition

) { Execute when the condition is true

}

##Example

<?php
 $sun=100;
 if($sun>90){
     echo "100>90";
 }
 ?>

##if. . .else statement



## Use the if....else statement to execute code when a condition is true and another section of code when the condition is false. Syntax

if(

Condition){

Execute when the condition is true

} else {

Execute when the condition is false

}

Example

<?php
 $sun=110;
 if($sun>200){
     echo "$sun>200";
 }else{
     echo "$sun<200";
 }
 ?>

##


if...elseif....else statement

##if....elseif...else statement Select one of several code blocks to execute.

Syntax

if(Condition 1 ) {

## Execute when condition 1 is true

} elseif(

Condition 2) {

Executed when condition 2 is true

}

else{

Executed when the conditions are not met

}

Example

<?php
 header("Content-type:text/html;charset=utf-8");    //設(shè)置編碼
 $sun=150;
 if($sun>200){
     echo "滿足條件1";
 }elseif($sun<180){
     echo "滿足條件2";
 }else{
     echo "都不滿足條件";
 }
 ?>


PHP - switch statement
We will learn the switch statement in the next section.


Continuing Learning
||
<?php $sun=110; if($sun>200){ echo "$sun>200"; }else{ echo "$sun<200"; } ?>
submitReset Code