Created
June 30, 2016 10:27
-
-
Save phosphore/65f53bebc417b930131b4987ba18af61 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
preg_match("/^\/per-(.*?)(-a-(.*))?\.html/", $this->uri, $matches); // vediamo se l'uri è /per-qualcosa.html o /per-qualcosa-a-luogo.html | |
if (count($matches) === 0) { // è solo una città | |
preg_match("/^\/(.+)\.html/", $this->uri, $cityArray); | |
$city = $cityArray[1]; | |
echo $city; | |
} else if (count($matches) === 2) { // solo una professione $matches[1] | |
$profession = $matches[1]; | |
echo $profession; | |
} else { //una professione e una città | |
$profession = $matches[1]; | |
$city = $matches[3]; | |
echo $profession. " " .$city; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment