PHP Superglobal

Sujitha

PHP Superglobal

         Superglobals are global arrays that are accessible from any part of your PHP script, and they provide essential information about the environment and user input. Superglobals are automatically populated by PHP, and they are prefixed with a $ symbol.

The superglobal variables are:
  • $_GET
  • $_POST
  • $_REQUEST
  • $_SESSION
  • $_COOKIE
  • $_SERVER
  • $_ENV
  • $_FILES
  • $_GLOBALS
$_GET
    This superglobal is an associative array that contains data sent to the script via URL query parameters (HTTP GET method). It is often used to retrieve data from the URL.

$_POST
    This superglobal is an associative array that contains data sent to the script via an HTTP POST request. It is commonly used for form submissions to retrieve data.

$_REQUEST
     This superglobal combines data from both $_GET and $_POST, as well as $_COOKIE, allowing you to access data sent to the script through various methods.

$_SESSION
     This superglobal is used to store session variables. Session variables can be used to persist data across multiple page requests for a single user session.

$_COOKIE
    This superglobal is an associative array that contains all the cookies sent by the client's browser to the server.

$_SERVER
     This superglobal contains information about the server and the execution environment. It includes data such as server information, request headers, and file paths.

$_ENV
     This superglobal is an associative array that contains variables passed to the script via the environment method (typically through the server configuration).


$_FILES
     This superglobal is used to retrieve information about file uploads made via HTTP POST. It provides details about uploaded files like file names, types, and temporary file locations.

$_GLOBALS
     This superglobal is an associative array containing all global variables. It allows you to access any global variable within a function or a class.






Our website uses cookies to enhance your experience. Learn More
Accept !

GocourseAI

close
send