- if语句
$a = 2;
$b = 1;
if($a>$b){
echo "a大于b";
}
输出:a大于b
2.if...else语句
$a = 1;
$b = 2;
if($a>$b){
echo "a大于b";
}else{
echo "a不大于b";
}
- if...elseif....else
$a = 1;
$b = 1;
if($a>$b){
echo "a大于b";
}elseif($a<$b){
echo "a小于b";
}else{
echo "a等于b";
}
输出:a等于b
- switch语句
$a = 6;
switch ($a){
case 5;
echo '555';
break;
case 4;
echo '444';
break;
case 6;
echo '666';
break;
case 7;
echo '777';
}
输出:666
标签:语句,控制,echo,break,case,else,大于,php From: https://www.cnblogs.com/xrwcm/p/17626303.html