PHP - Predefined Variables - 15 Superglobals

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

$argv

Array of arguments passed to script. Contains an array of all the arguments passed to the script when running from the command line.

$HTTP_RAW_POST_DATA

Raw POST data. contains the raw POST data

$GLOBALS

References all variables available in global scope. An associative array containing references to all variables which are currently defined in the global scope of the script. The variable names are the keys of the array.

$_SERVER

Server and execution environment information Is an array containing information such as headers, paths, and script locations. The entries in this array are created by the web server. There is no guarantee that every web server will provide any of these; servers may omit some, or provide others not listed here. That said, a large number of these variables are accounted for in the » CGI/1.1 specification, so you should be able to expect those.

$_SESSION

Session variables An associative array containing session variables available to the current script. See the Session functions documentation for more information on how this is used. $HTTP_SESSION_VARS contains the same initial information, but is not a superglobal. (Note that $HTTP_SESSION_VARS and $_SESSION are different variables and that PHP handles them as such)

What are Superglobals?

Superglobals are built-in variables that are always available in all scopes

$_COOKIE

HTTP Cookies An associative array of variables passed to the current script via this superglobal.

$_FILES

HTTP File Upload variables. An associative array of items uploaded to the current script via the HTTP POST method. The structure of this array is outlined in the POST method uploads section. $HTTP_POST_FILES contains the same initial information, but is not a superglobal. (Note that $HTTP_POST_FILES and $_FILES are different variables and that PHP handles them as such)

$_GET

HTTP GET variables An associative array of variables passed to the current script via the URL parameters. $HTTP_GET_VARS contains the same initial information, but is not a superglobal. (Note that $HTTP_GET_VARS and this variable are different variables and that PHP handles them as such)

$_POST

HTTP POST variables. An associative array of variables passed to the current script via the HTTP POST method when using application/x-www-form-urlencoded or multipart/form-data as the HTTP Content-Type in the request.

$_REQUEST

HTTP Request variables. An associative array that by default contains the contents of $_GET, $_POST and $_COOKIE.

$http_response_header

HTTP response headers. This array is similar to the get_headers() function. When using the HTTP wrapper, also will be populated with the HTTP response headers and will be created in the local scope.

$_ENV

Environment variables. An associative array of variables passed to the current script via the environment method. These variables are imported into PHP's global namespace from the environment under which the PHP parser is running. Many are provided by the shell under which PHP is running and different systems are likely running different kinds of shells, a definitive list is impossible. Please see your shell's documentation for a list of defined environment variables. Other environment variables include the CGI variables, placed there regardless of whether PHP is running as a server module or CGI processor. $HTTP_ENV_VARS contains the same initial information, but is not a superglobal. (Note that this variable and $HTTP_ENV_VARS are different variables and that PHP handles them as such)

$argc

The number of arguments passed to script. Contains the number of arguments passed to the current script when running from the command line.

$php_errormsg

The previous error message. a variable containing the text of the last error message generated by PHP. This variable will only be available within the scope in which the error occurred, and only if the track_errors configuration option is turned on (it defaults to off).


Ensembles d'études connexes

Peds - Chapter 25: Nursing Care of the Child With a Hematologic Disorder

View Set

Pharmacology Unit 4 Med Administration

View Set

Abnormal Psych Exam 2 - Ch. 8 Dissociative and Somatic Symptom Disorders

View Set

INTERMEDIATE ACCOUNTING MIDTERM 2

View Set

Chapter 12: Life at Home: Families and Relationships

View Set

CH. 23 - Nursing care of the child with an alteration in tissue integrity/integumentary disorder

View Set