在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