This page will go over what predefined variables are in PHP.

What is a predefined variable in PHP?

A predefined variable in PHP is a variable that already has a value before the PHP code is executed. There are many different kinds of predefined variables in PHP, and they allow someone to quickly learn information. Below this text, I will provide two examples of a predefined variable using the $_Server variable.

Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)

The predefined variable that was used to show the result above is $_SERVER['HTTP_USER_AGENT']. This predefined variable shows the browser and oprating system of the user that is accessing the PHP script.

Below this will be an example of another predefined variable in PHP.

Apache

The predefined variable that was used to show the result above is $_SERVER['SERVER_SOFTWARE']. This predefined variable shows the web application that the PHP script is running on.