在php中,它匹配什麼?它什麼時候返回true?
if($something) {
}
在php中,它匹配什麼?它什麼時候返回true?
if($something) {
}
if($something) {
}
任何東西,除了0
,null
,[]
,''
,false
,undefined
,"0"
將返回true。
http://php.net/manual/en/types.comparisons.php應該是有趣的。 –
請檢查:PHP手冊/語言參考/控制結構/ [if](http://php.net/manual/en/control-structures.if.php) –
[Truthy,Falsey,type-juggling](http: //php.net/manual/en/language.types.type-juggling.php)。是的,這些都是高度技術性的術語。 – MonkeyZeus