View Full Version : if (not US && not CA && not MX) {splat;}

03-26-2007, 05:37 AM
I've got a rough code that works, but just doesn't look right. I like it because I made it, it's small, and it does what I want, but I'm thinking there's a better way.

if (
$countryName != "United States" &&
$countryName != "Canada" &&
$countryName != "Mexico" )

Is this okay or is there a smaller, more compact version of something like this? I'm killing the page for anyone who IS NOT from those three countries.

03-26-2007, 06:00 AM
The only other solution is to use an in_array() function and write those countries to the array. Otherwise, the way you have it is as easy as it gets