Jump to content

Recommended Posts

Good day gents and gentets!

 

I just wanted to ask the opinion of others on the following:

 

When recieveing values, usually through $_POST or $_GET one would determain if a value was actually received by doing a isset(..) on the value element or just the whole array. But would you aggree or disagree that it would be good practice to also have a empty(..) check on the same value?

 

I have had incidents where the value/variable etc received was set but happened to be empty.

 

I wonder if i should make it a required practice to always do both a isset() and empty()?

 

your input will be values! :)

Personally, i just do empty() if it needs to be a valid value since it checks whether is it set and if it has a true value.  If i just want to know if it is set then i just use isset(since it is slightly faster). Using both is pointless since empty() does the same thing as isset(), just does more than isset().

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.