Cannot Use Isset On Expression, So Use What?

../_images/isset_on_expression.png

isset() works on data containers, such as variables, properties, array elements, but not on literal or constant values.

For literal values, it is recommended to avoid using isset, but make a comparison to null, instead.

And of course, the error message is the same when the code uses both solutions at the same time. This may lead to confusion: the message suggests using null !== (NULL !== A), instead of isset(NULL !== A).

See Also

PHP Error Messages

PHP Features