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