“Php/keyword elseif”的版本间差异
来自菜鸟教程
(Bot commit) |
小 (机器人:添加分类Php基础教程) |
||
第1行: | 第1行: | ||
− | |||
= PHP elseif关键字 = | = PHP elseif关键字 = | ||
第72行: | 第71行: | ||
[[../php_ref_keywords|Keywords PHP关键字]]<br /> | [[../php_ref_keywords|Keywords PHP关键字]]<br /> | ||
+ | |||
+ | [[分类:Php基础教程]] |
2020年11月12日 (四) 08:45的最新版本
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否则教程
.