Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
The PHP Workshop

You're reading from   The PHP Workshop Learn to build interactive applications and kickstart your career as a web developer

Arrow left icon
Product type Paperback
Published in Oct 2019
Publisher Packt
ISBN-13 9781838648916
Length 604 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (8):
Arrow left icon
Markus Gray Markus Gray
Author Profile Icon Markus Gray
Markus Gray
David Carr David Carr
Author Profile Icon David Carr
David Carr
Bart McLeod Bart McLeod
Author Profile Icon Bart McLeod
Bart McLeod
Mark McCollum Mark McCollum
Author Profile Icon Mark McCollum
Mark McCollum
Alexandru Busuioc Alexandru Busuioc
Author Profile Icon Alexandru Busuioc
Alexandru Busuioc
Jordi Martinez Jordi Martinez
Author Profile Icon Jordi Martinez
Jordi Martinez
M A Hossain Tonu M A Hossain Tonu
Author Profile Icon M A Hossain Tonu
M A Hossain Tonu
Vijay Joshi Vijay Joshi
Author Profile Icon Vijay Joshi
Vijay Joshi
+4 more Show less
Arrow right icon
View More author details
Toc

PHP Superglobals

The PHP engine uses a list of built-in variables that are accessible anywhere in a PHP script, called superglobals. These superglobals contain data that is mostly related to requests, but they also contain some server information and running PHP script file information as well.

The most frequently used superglobals are the $_SERVER, $_SESSION, $_GET, $_POST, $_COOKIE, and $_FILES variables.

A good practice is to not mess with superglobals across a project, meaning it would be better not to alter the existing data or to add more or remove data from these variables. Ideally, you would only access them once per request. $_SESSION is an exception in this matter, as its data is provided by the application and not by the PHP engine.

You can always learn about superglobals in more depth by visiting the official PHP documentation page, at http://php.net/manual/en/language.variables.superglobals.php.

$_SERVER

The $_SERVER superglobal contains request headers...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at AU $24.99/month. Cancel anytime