logansama Posted January 6, 2009 Share Posted January 6, 2009 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! Quote Link to comment https://forums.phpfreaks.com/topic/139654-double-checking-recieved-values-good-practice/ Share on other sites More sharing options...
Liquid Fire Posted January 6, 2009 Share Posted January 6, 2009 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(). Quote Link to comment https://forums.phpfreaks.com/topic/139654-double-checking-recieved-values-good-practice/#findComment-730933 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.