Home >Backend Development >PHP Problem >How to define super global variables in php
When using global variables in PHP functions, we need to use the global keyword to declare the content used, but if there is no variable declared with the global keyword, we call it a super
Global variables.
Super global variables are variables defined in PHP and cannot be added arbitrarily by users. They mainly store values received from the Web server.
Let’s take a look at the types and formats of superglobal variables
There are currently nine types of superglobal variables in php
$GLOBALS $_SERVER $_REQUEST $_POST $_GET $_FILES $_ENV $_COOKIE $_SESSION
These are associative arrays, so they are the same as Use the same for other arrays.
For example, if you access the URL https://server.com/user.php?id=123, use $ _GET $ _GET ["id"], you can get "123".
The above is the detailed content of How to define super global variables in php. For more information, please follow other related articles on the PHP Chinese website!