Global variables are spacial type variables that can be accessed from anywhere within the Code, including inside functions, classes, and methods.
Some global variables:
- $_SERVER: Contains information about the server and the current request.
- $_GET: Contains variables passed to the script via URL parameters.
- $_POST: Contains variables passed to the script via HTTP POST method.
- $_FILES: Contains variables related to file uploads via HTTP POST method.
- $_COOKIE: Contains variables passed to the script via HTTP cookies.
- $_SESSION: Contains variables accessible across multiple pages for a user's session.
- $_REQUEST: Contains variables passed to the script via both GET, POST, and COOKIE methods.
- $_ENV: Contains variables passed to the script via the environment.
- $GLOBALS: An associative array containing references to all variables that are currently defined in the global scope of the script.