...

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



ArcticFox
03-26-2007, 04: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" )
{exit;}

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.

Fou-Lu
03-26-2007, 05: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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum