I just came across a strange situation. When I try the following code in
$ php -a
php > var_dump(isset(null));
PHP Fatal error: Cannot use isset() on the result of an expression
(you can use "null !== expression" instead) in php shell code on line
php > var_dump(empty(null));
Testing if an expression is "set" doesn't make sense. As per the manual,
isset is used to
Determine if a variable is set and is not NULL.
If you want to check if an expression is null, use
is_null, or as the error message suggests,
null !== expression.
The manual for empty suggests something similar:
Determine whether a variable is considered to be empty.
until you read slightly further down, in the changelog:
5.5.0 empty() now supports expressions, rather than only variables.
Prior to this,
empty(null) would have thrown an error along the lines of
Parse error: syntax error, unexpected ')', expecting :: (T_PAAMAYIM_NEKUDOTAYIM) in ... on line ...