title: How can I add GET variables to end of the current url in php?
body: <p>I am trying to add a few different GET variables to the url.</p>
  
  <p>I could easily do a header redirect to the current page url and then just add the $_GET['test'] in the url.</p>
  
  <p>My problem is that I have some GET variables that are in the url already. What I want to do is:</p>
  
  <ul>
  <li><p><strong>Check if there are any GET variables in the url</strong></p>
  
  <ul>
  <li><p>If there is not, then redirect to the current url with the new GET['test'] variable at the end of the url. </p></li>
  <li><p>If there is, but there is no GET['test'] variable in the url, then keep those other GET values in the url and add the GET['test'] variable to end of the full url string</p></li>
  <li><p>If there is, AND there is a GET['test'] variable in the url, then keep those other GET values in the url and exchange the GET['test'] variable value with the new value.</p></li>
  </ul></li>
  </ul>
  
  <p>How can I go about checking for all these conditions?</p>