Parse URL
$url = "http://test.studio2108dev8.com/mo/st-louis/gateway-high/";
$url_path = parse_url($url, PHP_URL_PATH);
$url_parts = array_filter(explode("/",$url_path));
$parts_count = count($url_parts);
switch ($parts_count) {
case 1:
echo "1";
$is_a_state = is_a_state($parts_count[0]);
break;
case 2:
echo "2";
$is_a_city = is_a_city($parts_count[1]);
break;
default:
$all_tags = $url_parts;
unset($all_tags[0]);
unset($all_tags[1]);
break;
}
function is_a_state($slug) {
}
function is_a_city($slug) {
}