Last Updated: February 25, 2016
·
855
· fredylg

*isset() != empty()*, dont belive on everything eway says !!

isset() != empty() , just use empty... is way more reliable

3 Responses
Add your response

This is different functions and you are using them wrong. You need to use isset() when you aren't sure variable or key is setted. Otherwise it makes notice error (I don't recomend to disable notices - this is a good sign about problems in code). If you are sure variable/key is setted and need to verify empty that or not - use empty() or this construction:

if (!!$var){
//not empty
}

over 1 year ago ·

@border-radius Thats the whole point of the note, the "EWAY" payment system documentation uses isset() with the purpose of checking the if a variable has a value wicht is absolutely wrong. to check is a variable has a value the right thing to do is use empty.

over 1 year ago ·

@border-radius empty() does not generate any kind of message for a variable that doesn't exist. This is mentioned in the documentation for empty: http://php.net/empty

over 1 year ago ·