Difference between global variables $ GLOBALS and global in PHP, globalsglobal
Global generates an alias variable pointing to the external variable of the function in the function, instead of the real external variable of the function.
$ GLOBALS [] is actually called as an external variable, and the internal and external functions will always be consistent.
For member variables in the class, functions in the class must be accessed using the $ this-> method, and the $ GLOBALS method cannot be used:
Global is used to define global variables. However, this global variable is not applied to the entire website, but to the current page, including all files including include or require.
"Global $ var1;" is an alias variable that generates the external function $ var1 "$ var1". It is not a real external function variable and exists only inside the function, therefore, deleting an alias variable in a function does not affect the external variables, but you can modify the values of the external variables of the function.