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
Feb 05, 2009 @ 17: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.
tagged: get files request superglobal http request content confuse

Link:

Gentoo Blog:
PHP's Simplicity Can Confuse Folks Looking For Complexity
Aug 05, 2006 @ 14:04:33

On the Gentoo blog today, there's a note for those just getting into PHP - a warning of sorts for them to not read too much into the language.

Stuart Herbert advises those coming into PHP, both from other languages and as a first language, to not expect things to be overly complex. PHP is all about simplicity, and he reminds readers with a few points about objects in PHP.

His three points are:

  • Classes and inheritence are not new to PHP 5
  • Managing state between pages is very straight forward in PHP
  • Folks who follow design patterns religiously are missing the point

And that's the beauty of PHP over many of the other tools that you have. If you want to write a system that's entirely object-oriented, you can. But you don't have to. You can create and use objects where they make sense, and you can continue to use global functions where they make sense. PHP's neutral philosophy gives you the freedom to just get on with it, and do what's right for your needs, your skills, and your tastes.
tagged: php5 objects simplicity complexity confuse php5 objects simplicity complexity confuse

Link:

Gentoo Blog:
PHP's Simplicity Can Confuse Folks Looking For Complexity
Aug 05, 2006 @ 14:04:33

On the Gentoo blog today, there's a note for those just getting into PHP - a warning of sorts for them to not read too much into the language.

Stuart Herbert advises those coming into PHP, both from other languages and as a first language, to not expect things to be overly complex. PHP is all about simplicity, and he reminds readers with a few points about objects in PHP.

His three points are:

  • Classes and inheritence are not new to PHP 5
  • Managing state between pages is very straight forward in PHP
  • Folks who follow design patterns religiously are missing the point

And that's the beauty of PHP over many of the other tools that you have. If you want to write a system that's entirely object-oriented, you can. But you don't have to. You can create and use objects where they make sense, and you can continue to use global functions where they make sense. PHP's neutral philosophy gives you the freedom to just get on with it, and do what's right for your needs, your skills, and your tastes.
tagged: php5 objects simplicity complexity confuse php5 objects simplicity complexity confuse

Link:


Trending Topics: