What is superglobal variable in php?

A few predefined factors in PHP are “superglobals”, which implies that they are constantly open, paying little respect to scope – and you can get to them from any capacity, class or record without doing anything uncommon.

We have defined the brief about all superglobal variables.
These are superglobal variable-

  • $_SERVER
  • $_POST
  • $_GET
  • $_FILES
  • $_ENV
  • $_COOKIE


$GLOBALS is a PHP superglobal variable which is used to access global variables from anywhere in the PHP script.

Paste this code into your text editor and see the result.
For example-

function funcname()
global $example;
echo “This is example of” .” “.$example;
<title>fist title</title>
<p><?php funcname(); ?></p>



This is example of global-variable.

Leave A Comment?

eight − 4 =