So I have this sample string:
?items=3744130|1^356221|2^356222|1
extracted from a URL:
http://www.example.com/process.php?items=3744130|1^356221|2^356222|1
I need to convert it into this, and for the life of me I'm getting stuck.
?items=model_1=3744130&qty_1=1&model_2=356221&qty_2=2&model_3=356222&qty_3=1
I've gotten this far but that's it.
$url = substr($_SERVER['QUERY_STRING'],6);
$query = explode('^', $url);
echo http_build_query($query, 'model_');
Output currently is:
model_0=1234435%7C9&model_1=56788%7C9&model_2=6758765%7C9&model_3=3736543%7C9
How can I get the first set to be model_1
instead of the default model_0
?
Thanks