Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Replace values in a URI query string

Tags:

php

I have part of a query string that I want to make a replacement in. I want to use preg_replace but am kind of hung up on the regex.

Can someone please help? What I need replaced are the GET vars.

Here is the string:

bikeType=G&nikeNumber=4351
like image 350
John Avatar asked Feb 14 '26 05:02

John


1 Answers

PHP has a convenient function to parse query strings: parse_str(). You might want to take a look at that or provide more details as your question isn't exactly clear.

like image 121
Matteo Riva Avatar answered Feb 16 '26 19:02

Matteo Riva



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!