哪种方式是检查非null变量的正确方法

Which is the more effective way of checking whether $value is not null

if ($value > 0 && $value !== 'null') { }

or

if (empty($value)) { }
if(!empty($value)){
 //do stuff
}else{
// do somthing else
}

PHP has an elegant is_null function to check if a variable is actually NULL.

if (is_null($value)) {
    // so something
}

empty, on the other hand, checks for empty strings (''), zeroes (as integers, floating points or even the string '0'), FALSE, empty arrays, uninitialized variables and NULLs.