Server-Side PHP: Part 3: $_GET, $_PUT, and $_REQUEST

Server-Side PHP

PHP is a programming language frequently used for server-side web development.


$_GET, $_PUT, and $_REQUEST

Like $_SERVER, there are two other superglobals for accessing content sent to the server $_GET and $_PUT.

Depending on the HTTP method used by the client, data will either be in the $_GET or $_PUT variable.

$_GET

Data sent via the GET method is encoded as part of the requesting URL. Anything sent to the server using this method will be found in the $_GET variable on the server.

$_PUT

Data sent via the PUT method is encoded in the body of the content rather than part of the requesting URL. Similar to $_GET, any data sent via this method will be found in the $_PUT variable.

$_REQUEST as combination of $_GET and $_PUT

Introduced in PHP 4.1.0, the $_REQUEST superglobal variable contains all data from the globals $_GET, $_PUT, and $_COOKIE. While a separate variable, it can be used a shorthand for accessing data passed via either $_GET or $_PUT methods.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.