PHP 的 null与空

以下测试会通过:

public function testNullEmpty()
{
echo PHP_EOL.'empty equals null';

$this->assertTrue( '' == null );
$this->assertFalse( '' === null );
$this->assertTrue( !is_null('') );
$this->assertTrue( !in_array(null, [''], true) );
$this->assertTrue( in_array(null, ['']) );
$this->assertTrue( !empty(['']) );
$this->assertTrue( !empty([null]) );
}
posted @ 2016-10-06 20:33  小天儿  阅读(156)  评论(0)    收藏  举报