使用empty()函数检查对象是否为空是否正确?

sk8*_* ツ 3 php

说,

$obj = $this->someFunc(); // this returns an object

if(empty($obj)){ 
    // suppose $obj is null, it does works correctly
}
Run Code Online (Sandbox Code Playgroud)

http://php.net/manual/en/function.empty.php中,empty()仅用于变量和数组.

但是,这是正确的方法吗?

cet*_*eth 8

php具有is_null()确定对象是否为null 的函数:http://php.net/manual/en/function.is-null.php