lundi 6 novembre 2017

Simple PHP comparison doesn't seem to work

I am trying to check if the user is coming from outside the Netherlands or Belgium by using the following 'code':

$countrycode = 'NL'; 

if ($countrycode !== 'NL' || $countrycode !== 'BE') {
echo 'you are not from NL or BE';
} else {
echo 'you are from: ' . $countrycode;
}

I cannot figure out why it's echoing the first occurrence.

PS: I know I could just switch it by using === instead but I kinda wish to know why or what I am doing wrong.

Thanks

Aucun commentaire:

Enregistrer un commentaire