title: Decoding query strings in PHP
body: <p>Okay, so I've written a REST API implementation using mod_rewrite and PHP.  I'm accepting a query string via the body of HTTP DELETE requests (... collective groan?).  Arguments about the wisdom of both previous statements aside, what I've found is that PHP doesn't automatically parse the request body of DELETE requests (i.e. $_POST is empty despite form-encoded query string appearing in body of request).  This didn't particularly surprise me.  What I did find surprising was that I've been unable to find a built-in PHP function for parsing a query string??  Have I simply overlooked something?  I can do something like:</p>
  
  <pre><code>public function parseQS($queryString, &amp;$postArray){
    $queryArray = explode('&amp;', $queryString);
    for($i = 0; $i &lt; count($queryArray); $i++) {
      $thisElement = split('=', $queryArray[$i]);
      $postArray[$thisElement[0]] = htmlspecialchars(urldecode($thisElement[1]));
    }
  }
  </code></pre>
  
  <p>... it just seems odd that there wouldn't be a PHP built-in to handle this.  Also, I suspect I shouldn't be using htmlspecialcharacters &amp; urldecode to scrub form-encoded values... it's a different kind of encoding, but I'm also having trouble discerning which PHP function I should be using to decode form-encoded data.</p>
  
  <p>Any suggestions will be appreciated.</p>