Fueling Your Coding Mojo

Buckle up, fellow PHP enthusiast! We're loading up the rocket fuel for your coding adventures...

Popular Searches:

superglobals - Are few of the server variables been added and few have been removed in PHP 7?

Hey everyone,

I hope you're doing well. I've been working with PHP 7 recently and came across a pretty interesting question regarding some changes in superglobals. I couldn't find a concrete answer, so I thought I'd reach out to this knowledgeable community for some guidance.

In the past, I've used server variables like $_SERVER['REMOTE_ADDR'] and $_SERVER['REQUEST_METHOD'] to access useful information about the server and request. However, I heard that in PHP 7, a few server variables have been added and some have been removed.

Can anyone confirm if this is true? If yes, I'd love to know which server variables have been added in PHP 7 and which ones have been removed. It would be great to have an updated list of superglobals to work with.

Thanks in advance for your help!

All Replies


Hey there,

I've been exploring PHP 7 recently, and I can share my personal experience regarding the changes in superglobals. Interestingly, PHP 7 didn't introduce any new server variables to the superglobal $_SERVER array. So, the variables you were already familiar with like $_SERVER['REMOTE_ADDR'] and $_SERVER['REQUEST_METHOD'] remain the same.

However, there were a few server variables that got removed in PHP 7. One important variable that's no longer available is $_SERVER['HTTP_PROXY_CONNECTION'], which used to provide information about the client's proxy connection. If you relied on this variable in your code, you might need to find an alternative solution in PHP 7.

I hope this sheds some light on the changes in superglobals in PHP 7. Let me know if there's anything else you'd like to know!


Hey everyone,

I've been working with PHP 7 and thought I'd share my personal experience with the changes in superglobals. In PHP 7, I haven't come across any new server variables added to the $_SERVER superglobal. So, the familiar ones like $_SERVER['REMOTE_ADDR'] and $_SERVER['REQUEST_METHOD'] remain unchanged.

However, there were a couple of server variables that got removed in PHP 7. For example, $_SERVER['SCRIPT_FILENAME'], which used to provide the absolute path of the executing script, has been replaced by $_SERVER['PHP_SELF'] to obtain the same information.

It's important to note that while additions or removals to the superglobals have taken place in PHP 7, this might not be an exhaustive list. It's always a good idea to consult the PHP documentation or refer to the official PHP manual for a comprehensive understanding of the available superglobals in PHP 7.

I hope this helps! If you have any further questions or insights, feel free to share.


Hey there,

From my personal experience with PHP 7, I can confirm that there have indeed been some changes to the superglobals. In terms of additions, one new server variable that has been introduced is $_SERVER['HTTP_HOST'], which gives you the hostname of the current request.

Additionally, PHP 7 has removed a few server variables that were present in previous versions. One notable removal is $_SERVER['SCRIPT_FILENAME'], which used to provide the absolute path of the currently executing script. In PHP 7, this information can be obtained using $_SERVER['PHP_SELF'] instead.

I hope this information helps you out. Let me know if you have any further questions!

New to LearnPHP.org Community?

Join the community