News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
On $_GET and $_POST
February 05, 2009 @ 11:14:33

On the SitePoint PHP Blog today Troels Knak-Nielsen takes a deeper look at two of the superglobals a lot of PHP developers take for granted - $_GET and $_POST.

When a PHP script is invoked by a web server, it is as the result of a HTTP request. A HTTP request has a target URI and that URI consists of different parts. One of these parts is the query. As the PHP process starts up, the query gets parsed into an associative array. And for some reason, somebody decided on the unfortunate $_GET, because it's what you use for GET requests - right? Wrong!

He points out that all HTTP requests, regardless if they're GET or POST will have that GET information (not necessarily in $_GET, though). He also mentions another commonly used (and sometimes abused) superglobal - $_FILES. His biggest gripe, though, is that the naming of the variables confuses the developer as to the true content of the HTTP request.

And I won't even comment on the nastiness of $_REQUEST.
6 comments voice your opinion now!
get files request superglobal http request content confuse


blog comments powered by Disqus

Similar Posts

DevShed: Introducing Mediator Classes in PHP 5

Stefan Esser's Blog: PHP 5.3 and Delayed Cross Site Request Forgeries/Hijacking

PHP Security Blog: Goodbye HTTP Response Splitting, and thanks for all the fish

ServerGrove Blog: Implementing a staging/live website system with symfony and Apostrophe CMS

Jonathan Snook's Blog: Elemental: Conditional Content with CakePHP


Community Events





Don't see your event here?
Let us know!


podcast symfony api list series language introduction library laravel voicesoftheelephpant interview community deployment release framework install package opinion bugfix tips

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework