I can't figure out how to write the right pattern for my preg_replace pattern.
My situation is this: I've got an URL, let's suppose this:
$url = "first/second/third/fourth"
Now, I need to remove only the last "/" and all the characters after that. So my result should become like this:
first/second/third
For this moment I solved this way:
$result = substr($url, 0, (strrpos($url, "/")));
but I know there should be the right patter to be writted into my preg_replace.
Any suggestion?