DEV Community

Discussion on: Using isset() and empty() hurts your code

aleccaputo profile image
Alec Caputo

A situation where isset makes sense for me is checking $_POST. It's completely legitimate for a key to not be have been sent by the client.

aleksikauppila profile image
Aleksi Kauppila Author

In this case you’d be interested in both questions: does a value exist and is it something useful. I agree, it makes sense.

lawrencejohnson profile image

You could use filter_input and get much more useful info back than isset.