In case you have a url and you want to remove all parameters from it use this:
1 2 |
$str = 'http://www.example.com/page.php?a=123&b=567'; $strClean = preg_replace ('/\?.+$/', '', $str); |
This regex directive means – replace everything in the string coming after “?” with nothing.