Create link in PHP with Get Parameters
<p>I'm really new to php, but I'm working on a simple web page.</p>

<p>This page is quite configurable with different parameters. So, it may be called like:</p>

<p>www.example.com/index.php?test=1&amp;foo=3&amp;bar=4</p>

<p>Now my question is, what is the idiom for generating a link to the current page but with one parameter changed?</p>

<p>For example, I'd like to change foo to 5, what's the easiest way to generate a link like:</p>

<p>www.example.com/index.php?test=1&amp;foo=5&amp;bar=4</p>

<p>I can loop through and do it manually, but I figured there would be some common idiom for this.</p>

<p>Thanks a ton!</p>
