This should work for most cases:
function strip_key($key, $string)
{
$string = preg_replace("/(&|\?)($key=(\w+)?)(&?)/", '$1', $string);
return preg_replace('/(\?|&)$/', '', $string);
}
print strip_key("list", "yadda?bo=ra&list=XXX&two=three");
print strip_key("list", "yadda?bo=ra&list=&two=
this is what I use to get rid of "line" from the url
$qs = ereg_replace("&$", "", ereg_replace("line=[^&]*&?", "",
$QUERY_STRING));
HTH
MArtin
-Original Message-
From: Scott Reismanis [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 28, 2002 12:00 PM
To: [EMAIL PROTECTED]
Subject: [PHP] R
2 matches
Mail list logo