Skip to content

Instantly share code, notes, and snippets.

@jbrooksuk
Created October 31, 2011 16:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jbrooksuk/1327855 to your computer and use it in GitHub Desktop.
Save jbrooksuk/1327855 to your computer and use it in GitHub Desktop.
PHP Switch in_array
<?php
$curURL = trim($_SERVER['REQUEST_URI'], '/');
$arURLParts = explode('/', $_SERVER['REQUEST_URI']);
foreach($arURLParts as $urlPart) {
${$urlPart} = $urlPart;
switch ($urlPart) {
case 'hotels':
$hotelPage = (($_GET['brand'] == "excellence") ? false : true);
break;
case 'country':
$countryPage = true;
break;
case (in_array($res_iso_lookup[$urlPart][0], $res_iso_uri['cw']) ? $urlPart : ''):
$currentCountry = $urlPart;
break;
default:
$otherPage = $urlPart;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment