I wanted to remove all occurrences of specific pattern of a parameter from a URL using preg_expression. $url = "http://phpblogspot.com/link.php?r=test5&id=3726&location=24&sublocation="; $url2 = substr($url, 0, strpos($url, '?')); echo $url2;
The post PHP preg_replace expression to remove URL parameter after question mark appeared first on PHP Blog Spot.