What's the difference between 'isset()' and '!empty()' in PHP?

Viewed 45827

I don't understand the difference between isset() and !empty().

Because if a variable has been set, isn't it the same as not being empty?

7 Answers

Use !empty when there is a condition already present which is checking for true or false.

isset is more basic. empty incorporates more checks, hence needs to be used with care.

Related