douqiao5552 2016-02-23 03:05
浏览 302
已采纳

如何在php中结束if语句

The question is pretty much self-explanatory, I am having trouble how to end if statement in php.

For example,

<?php
if (argument) {
// end if statement
}
else if (different argument) {
// end if statement
}
else if (another different argument) {
// end if statement
}
else {
// do something
}
?>
  • 写回答

3条回答 默认 最新

  • dqzpt40064 2016-02-23 04:21
    关注

    Consider carefully how an if condition works:

    If (boolean condition) Then
        (consequent)
    Else
        (alternative)
    End If
    

    When an interpreter finds an If, it expects a boolean condition ... and evaluates that condition. If the condition is true, the statements following the then are executed. Otherwise, the execution continues ... After either branch has been executed, control returns to the point after the end If.

    The if statement will end if none of its conditions evaluate to true or if one of its conditions evaluate to true. The statement(s) associated with the first true condition will evaluate, and the if statement will end.

    See Wikipedia's If–then(–else) for more.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 树莓派5怎么用camera module 3啊
  • ¥20 java在应用程序里获取不到扬声器设备
  • ¥15 echarts动画效果的问题,请帮我添加一个动画。不要机器人回答。
  • ¥15 Attention is all you need 的代码运行
  • ¥15 一个服务器已经有一个系统了如果用usb再装一个系统,原来的系统会被覆盖掉吗
  • ¥15 使用esm_msa1_t12_100M_UR50S蛋白质语言模型进行零样本预测时,终端显示出了sequence handled的进度条,但是并不出结果就自动终止回到命令提示行了是怎么回事:
  • ¥15 前置放大电路与功率放大电路相连放大倍数出现问题
  • ¥80 部署运行web自动化项目
  • ¥15 腾讯云如何建立同一个项目中物模型之间的联系
  • ¥30 VMware 云桌面水印如何添加