PHP Server and How to use $_SERVER variables in PHP

$_SERVER Introduction

In PHP $_SERVER is a superglobal, an array which contains different information like headers, path, Server name, Server software, Server protocol, IP address, and few others. However you may access all or not depends on your hosting or web server where your site is hosted.

$_SERVER Example

Below is a list of few useful $_SERVER variables that can be written in PHP program to return values, some of which can prove to be really useful to know about:



One example where $_SERVER is used to get current URL is given here


Was this article helpful?

Related Articles

Leave A Comment?