DEV Community

loading...

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

Collapse
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.

Collapse
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.

Collapse
lawrencejohnson profile image
Lawrence

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