我一直使用这段代码来运行一行if语句。
$variable = TRUE; // or anything that evaluates to TRUE
$variable && execute_code();基本上,如果$variable为真,它将运行该函数。
我的问题是:这样做的正确术语是什么?
发布于 2013-07-10 16:52:49
它被称为Short-circuit evaluation。
短路表达式
x Sand y(用沙子表示短路种类)等同于条件表达式if x then y else false;,表达式x Sor y等同于if x then true else y。
https://stackoverflow.com/questions/17566177
复制相似问题