PHP Predefined Variables

Example 1: SERVER_NAME

Server Name: atomar.soisweb.uwm.edu

Example 2: PHP_SELF

Current Page: /infost440/a3/predefined.php

What Each Variable Means

SERVER_NAME: This shows the name of the server where the PHP page is running.

PHP_SELF: This shows the filename or path of the currently running PHP page.

Explanation

Predefined variables are variables that PHP automatically provides for programmers. We do not have to create these variables ourselves. They contain useful information about the server, browser, requests, and current PHP page. In this example, I used the $_SERVER predefined variable to access information about the server and the current page.

Back to Activity 3 Home