note 29092 deleted from function.parse-url by didou

From: Date: Sat, 03 Feb 2007 03:10:29 +0000
Subject: note 29092 deleted from function.parse-url by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-122624@lists.php.net to get a copy of this message
Note Submitter: bermi.ferrer ) a t ( akelos d·o·t com ---- This is a small update for Steve's function. It removes the Argument even if its repeated more than once in the URL. This function performance is better than the one I posted before (delete_value_from_url). function RemoveArgFromURL($URL,$Arg) { while($Pos = strpos($URL,"$Arg=")) { if ($Pos) { if ($URL[$Pos-1] == "&") { $Pos--; } $nMax = strlen($URL); $nEndPos = strpos($URL,"&",$Pos+1); if ($nEndPos === false) { $URL = substr($URL,0,$Pos); } else { $URL = str_replace(substr($URL,$Pos,$nEndPos-$Pos),'',$URL); } } } return $URL; }

« previous php.notes (#122624) next »