Search code examples
phpsuperglobals

Why doesn't the $GLOBALS superglobal has an underscore?


Just for curiosity. All superglobals (for example $_POST, $_GET, $_FILES, $_SESSION) have an underscore and only the $GLOBALS superglobal does not. Why is that so? What does the underscore mean in superglobal variables in PHP and generaly in PHP? Thanks in advance.


Solution

  • I saw a note on PHP manual page that says

    Note: Variable availability Unlike all of the other superglobals, $GLOBALS has essentially always been available in PHP.

    May be that's why they want to keep it like this, but this is just a guess.

    http://php.net/manual/en/reserved.variables.globals.php