Php/keyword elseif
来自菜鸟教程
PHP elseif关键字
例
如果不满足第一个条件,请测试第二个条件:
<?php
if(5 < 3) {
echo "Five is less than three";
} else
if(5 > 4) {
echo "Five is greater than four";
}
?>
定义和用法
The
elseif
关键字测试新条件,如果先前的条件
if
or
elseif
声明不符合。相当于放一个
if
else块中的语句。
以下代码块是等效的:
<?php
if (...) {
some code here
} elseif (...) {
some
code here
}
?>
<?php
if (...) {
some code here
} else{
if (...)
{
some code here
}
}
?>
相关页面
The
if
关键词。
阅读更多有关if ... elseif ... else条件的信息 PHP否则教程
.