I have a URL as a string in $url
.
I want to replace a specific parameter (if it exists) in the URL.
For example
$url = "http://www.xxx.xxx?data=1234324&id=abc&user=walter";
I'd like check if id
exists and if it does, I want to replace the value of that id
to a specific value. But the value of the id
isn't always the same and it's not always in the same place.