Superglobals are built-in variables that are always available in all scopes.
Several predefined variables in PHP are "superglobals", which means they are available in all scopes throughout a script. There is no need to do
global $variable; to access them within functions or methods.
By default, every variable in bash is global to every function, script and even the outside shell if you are declaring your variables inside a script.
If you want your variable to be local to a function, you can use
local to have that variable a new variable that is independent to the global scope and whose value will only be accessible inside that function.