$GLOBALS

This super-global is a PHP predefined variable, which holds a reference to every global variable in the application.

<?php

// implicit global variable
$aGlobalVariable = 1;

function foo() {
    echo $GLOBALS['aGlobalVariable'];
    $GLOBALS['aGlobalVariable'] = 2;
}

foo(); // displays 1
echo aGlobalVariable; // 2

?>

Documentation

See also PHP 8.1: $GLOBALS variable restrictions and Understanding PHP Globals and Variable Scope in WordPress.

Related : $_ENV, $_SERVER, $argv, $php_errormsg, Global Variables