变量/函数 | empty | is_null | isset |
---|---|---|---|
$a = 1 | false | false | true |
$a = 0 | true | false | true |
$a = ' hello word' | false | false | true |
$a = '' | true | false | true |
$a = 6.6 | false | false | true |
$a = 0.0 | true | false | true |
$a = true | false | false | true |
$a = false | true | false | true |
$a = array(1,2,3) | false | false | true |
$a = array() | true | false | true |
$a = null | true | true | false |
$a | true | true(报错) | false |
unset($a) | true | true(报错) | false |
$array = ['']; empty($array)结果为true
还有资源类型,对象等类型规则同上