To modify a PHP system, only to find that the scope and lifetime of the PHP variable is very different, this record has been consulted:
The main variables in PHP scripts are: Built-in super global variables, general variables, constants, global variables, static variables and so on;
1. Built-in super global variables can be used and visible anywhere in the script. That is, if we change one of the values in a PHP page, the value of the other PHP page will change as well.
The complete list of super global variables is as follows:
1. $GOBALS all global variable arrays
2.$_server Server environment variable array
3.$_post array of variables passed to the script via the POST method
4.$_get An array of variables passed to the script by the GET method
5.$_cookie array of COOKIE variables
6.$_files array of variables related to file uploads
7. $ENV An array of environment variables
8.$_request array of variables entered by all users includes input $_get $_post $_cookie
9.$_session Session Variable Array
2. Once the constants are declared, they can be globally visible, that is, they can be used inside and outside the function, but this is limited to a single page (containing the PHP script that we included through include and include_once), but it is not available in other pages. you must remember to refer to the page of the declaration .
Scope and lifetime of PHP variables