Scope of variables
- Scope spans the entire module, including “included” and “required” files.
- Variables defined outside of a function, can be referenced inside the function, if defined as globally available.
- Any variable defined inside a function can only be used within that function, unless specifically defined as globally available in that function.
- Globals can also be accessed via the special “GLOBALS” array.
- See “demo8” for examples.
$dbs = $GLOBALS["DATABASE"];