A function sees only its own variables (Subsection 4.4.10), except for nine superglobals visible everywhere without global: $_GET, $_POST, $_COOKIE, $_FILES, $_SERVER, $_ENV, $_REQUEST, $_SESSION (after session_start()) and $GLOBALS, which maps every global by name. Listing the arrays in $GLOBALS shows that some exist only on demand:
$ php -r 'echo implode(" ", array_keys(array_filter($GLOBALS, "is_array"))), "\n";'
argv _GET _POST _COOKIE _FILES _SERVER
$ php -r 'echo implode(" ", array_keys(array_filter($GLOBALS, "is_array"))), "\n"; $_REQUEST;'
argv _GET _POST _COOKIE _FILES _SERVER _REQUESTWith auto_globals_jit on, PHP builds $_REQUEST and $_ENV only for code that mentions them. $_ENV is empty anyway under Ubuntu 225 's variables_order = "GPCS", so use getenv(). Since PHP 8.1, $GLOBALS = []; is a compile error, though $GLOBALS['x'] = 1 works. Treat request arrays as read-only: filter_input() never sees your changes (filter_var).