I know this looks long and drawn out, but it's what I have here... I made a function for you that you can put your URL into, and it should (hopefully) spit out the URL you need...
function convertURL($url){
$parsed = parse_url($url);
$query = explode("&", $parsed['query']);
$newquery = "";
foreach($query AS $value){
$newvalue = explode("=", $value);
if($newvalue[0] == "b"){
$newquery .= $newvalue[0]."=".$newvalue[1];
}
}
$revampedurl = $parsed['scheme']."://".$parsed['host'].$parsed['path'];
if ($newquery != ""){
$revampedurl .= "?".$newquery;
}
return $revampedurl;
}
And here is the usage:
$url = "http://www.domain.com/index.php?a=1&b=2&c=3";
echo convertURL($url);
// OR
echo convertURL("http://www.domain.com/index.php?a=1&b=2&c=3");
Either way, your output should be:
http:// www.domain.com/index.php?b=2
If you didn't have the b= in the URL, then it will just output the URL like so:
http:// www.domain.com/index.php
Let me know if you need any help with this.