2016-06-07 26 views
-4

在php中,它匹配什麼?它什麼時候返回true?

if($something) { 
} 
+0

http://php.net/manual/en/types.comparisons.php應該是有趣的。 –

+0

請檢查:PHP手冊/語言參考/控制結構/ [if](http://php.net/manual/en/control-structures.if.php) –

+0

[Truthy,Falsey,type-juggling](http: //php.net/manual/en/language.types.type-juggling.php)。是的,這些都是高度技術性的術語。 – MonkeyZeus

回答

2
if($something) { 
} 

任何東西,除了0null[]''falseundefined"0"將返回true。

+0

什麼是負值? – MonkeyZeus

+0

與[]你的意思是一個空陣列? –

+0

哦,是的,那些也會返回錯誤。將更新我的答案。並且是[]是一個空數組。 – phreakv6