PHP Predefined Variables

Example 1: SERVER_NAME

Server Name: vijayku2.soisweb.uwm.edu

Example 2: PHP_SELF

Current PHP File: /infost440 /a3/predefined.php

What Each Variable Means

$_SERVER['SERVER_NAME']: This predefined variable provides the name of the server that is hosting and running the PHP webpage.

$_SERVER['PHP_SELF']: This predefined variable provides the path and filename of the PHP script that is currently being executed.

Explanation

Predefined variables are variables that PHP automatically makes available to a script. The programmer does not need to create these variables before using them. They can provide useful information about the server, webpage, request, user, and environment. The $_SERVER variable, for example, contains information about the server and the PHP script that is currently running.

Back to Activity 3 Home