title: Overwriting $_POST for PUT or DELETE requests
body: <p>In PHP I would like to be able to access <code>PUT</code> and <code>DELETE</code> vars globally similar to how <code>GET</code> and <code>POST</code> vars are accessed globally. I originally considered adding the data to <code>$_PUT</code> and <code>$_DELETE</code> respectively in the global namespace, but then I realized that the data for each request is stored in the message body so there's no way for there to be more than one dataset from a <code>POST</code>, <code>PUT</code>, or <code>DELETE</code> request.</p>
  <h2>Are there any side-effects of overwriting the <code>$_POST</code> variable?</h2>
  <p>i.e. <code>str_parse( file_get_contents( 'php://input' ), $_POST );</code></p>
  <p>Am I being silly, or is there a better way to access <code>PUT</code> and <code>DELETE</code> data?</p>
  <hr>
  <p>Edit to clarify my thinking:</p>
  <p>I am very well aware of the source of the data in <code>$_POST</code>, in fact i mentioned it earlier in my question. If a HTTP POST request is sent to the server the data is stored in <code>php://input</code>. If a HTTP PUT or DELETE request is sent to the server, the data is stored in the exact same place, meaning that <code>$_POST</code> will be empty (as no data was <code>POSTed</code> despite data being available.</p>
  <p>A <code>GET</code> request, on the other hand, is passed via the query string. This allows simultaneous passing of <code>$_POST</code> and <code>$_GET</code> variables. It is <strong>not</strong> possible to simultaneously pass <code>POST</code> and <code>PUT or DELETE</code> variables.</p>
  <p>If I overwrite <code>$_POST</code> from <code>php://input</code> on <code>PUT</code> and or <code>DELETE</code> requests, there is no data loss.</p>
  <p>The alternative of adding:</p>
  <pre><code>global $_PUT;
  global $_DELETE;
  </code></pre>
  <p>to the beginning of functions seems silly, as I'll only be able to use one at a time <em>anyway</em>.</p>
  <p>My first question, which is the one I really want answered, is about what side-effects or issues exist in overwriting <code>$_POST</code>. I can't possibly be the first person to try something as silly as:</p>
  <pre><code>$_POST['foo'] = 'bar';
  </code></pre>
  <p>I'm just concerned that if I do anything similar that it might not be preserved across scopes.</p>