I have this code:
$url = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$url = preg_replace("page=[\d]+","",$url);
I have a link like this: http://localhost/search?q=WORD+FOR+SEARCH&page=4
I'm trying to get that URL then to remove &page=. I never worked with regex for patterns. That's my code. Can someone help me ? Thank you !
This is the error I get when I try to execute that code:
preg_replace(): Delimiter must not be alphanumeric or backslash