On Oct 14, 2014, at 7:47 AM, Kris Craig <kris.cr...@gmail.com> wrote:
> Hey guys, > > Does anybody know why we have $_GET and $_POST, but not $_PUT and > $_DELETE? As far as I can tell, the only way to get these out currently is > to parse their values by reading the incoming stream directly. > > Is there a reason why we don't want this or is it just that nobody has > actually written it yet? > > —Kris This is due to the history of HTML forms sending POST requests with the Content-Type application/x-www-form-urlencoded. That is, all the fields are key/value pairs and may be easily converted into a PHP array. If you use POST with application/json, nothing appears in $_POST, for example. In practice, we could support $_PUT and $_DELETE for requests that use application/x-www-form-urlencoded, but most folks implementing PUT and DELETE do not use application/x-www-form-urlencoded for these requests. I would venture to say that most people implementing PUT requests accept application/json and most DELETE requests have no body at all. So, $_PUT and $_DELETE superglobals wouldn’t make sense. -Ben -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php