When questioning this I frequently refer to this website:
https://www.virendrachandak.com/techtalk/php-isset-vs-empty-vs-is_null/
It will provide you with a list of all of the equivalencies and what their truthiness is.
(undefined $var) == !isset($var) == empty($var) == is_null($var)
(var $var;) == !isset($var) == empty($var) == is_null($var)
($var = NULL) == !isset($var) == empty($var) == is_null($var)
So, yes, the two are equivalent.
The rest of your question gets complicated (in IDEOne):
<table><tr><td>Key</td><td>array_key_exists()</td><td>isset()</td><td>empty()</td><td>is_null()</td></tr><tr><td>$array['null']</td><td>true</td><td>false</td><td>true</td><td>true</td></tr><tr><td>$array['empty']</td><td>true</td><td>true</td><td>true</td><td>false</td></tr><tr><td>$array['zero']</td><td>true</td><td>true</td><td>true</td><td>false</td></tr><tr><td>$array['space']</td><td>true</td><td>true</td><td>false</td><td>false</td></tr><tr><td>$array['character']</td><td>true</td><td>true</td><td>false</td><td>false</td></tr><tr><td>$array['true']</td><td>true</td><td>true</td><td>false</td><td>false</td></tr><tr><td>$array['false']</td><td>true</td><td>true</td><td>true</td><td>false</td></tr><tr><td>$array['undefined']</td><td>false</td><td>false</td><td>true</td><td>true</td></tr></table>
If you want to do implicit checks, you have to do a combination:
if(array_key_exists($key, $array) {
$check = $array[$key];
if($check === NULL) {
// set and null
} elseif ($check === FALSE) {
// set and FALSE
} elseif ( /** additional checks, etc, etc... **/ ) { }
} else {
// Not set
}
Unfortunately, if the variable is not in an array, this is not possible to do without 'get_defined_vars()`, and I would highly discourage it's use in production code, as it will eat up memory due to non-referenced data (Objects will be represented by reference, but this will duplicate all other variables, causing an sharp increase in memory).
It is good coding practice to simply consider that undefined == !isset == NULL == empty
. Because what you are looking for is data, and no data is no data.