Server-Side PHP: Part 2: $_SERVER

Server-Side PHP

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


$_SERVER

$_SERVER is one of several superglobal variables that exist in PHP that can be used in server-side operations. In order to know things like the server port or name, this variable can be accessed.

As the PHP manual page warnings, some server environments may not populate certain values. However, those like SERVER_NAME, REMOTE_ADDR, and REMOTE_HOST can be depended on to have values regardless of server environment.

As reviewed in the last part, the values inside of $_SERVER can be seen through using a foreach loop to iterate through each key-value pair within it to generate a HTML table, mixing both HTML and a section enclosed within PHP short tags.

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.