5
我一直使用这段代码来运行一行if语句。
$variable = TRUE; // or anything that evaluates to TRUE
$variable && execute_code();
基本上,如果$variable
为TRUE,它将运行该函数。我的问题: 这样做的正确术语是什么?
我一直使用这段代码来运行一行if语句。
$variable = TRUE; // or anything that evaluates to TRUE
$variable && execute_code();
基本上,如果$variable
为TRUE,它将运行该函数。我的问题: 这样做的正确术语是什么?
短路表达
x Sand y
(使用砂来表示短路品种)等效于条件表达式if x then y else false;
表达x Sor y
相当于if x then true else y
。
这整天都在杀我。谢谢! – rgin
me2,我在js中使用过,但在php中似乎不能很好地工作...... – Ziarno
嗯,实际上它确实有效。至少在这种情况下。我的问题更多的是术语。 – rgin