Super Globals Types
PHP superglobals are special arrays that provide access to various global variables within the PHP environment. They are accessible from anywhere in a PHP script, regardless of scope, and contain valuable information related to the current script, server, and client request. Superglobals play a crucial role in web development, as they enable developers to interact with data passed through URLs, forms, cookies, sessions, and server environment variables.
Here are the most commonly used PHP superglobals:
$_GET
Contains variables passed to the script via the URL parameters (query string) using the HTTP GET method.
$_POST
Contains variables passed to the script via an HTTP POST request, usually from form submissions.
$_REQUEST
Combines data from $_GET, $_POST, and $_COOKIE arrays into a single associative array. It can be used to access user input regardless of the request method used.
$_FILES
Contains information about uploaded files submitted via HTTP POST requests. Each uploaded file is represented as an associative array.
$_COOKIE
Contains variables stored in the user's browser cookies. Cookies are used for storing user-specific data between HTTP requests.