[get_defined_vars()](<http://php.net/manual/en/function.get-defined-vars.php>) returns an array with all the names and values of the variables defined in the scope in which the function is called. If you want to print data you can use standard functions for outputting human-readable data, like [print_r](<http://php.net/manual/en/function.print-r.php>) or [var_dump](<http://php.net/manual/en/function.var-dump.php>).

var_dump(get_defined_vars());

Note: This function usually returns only 4 superglobals: $_GET,$_POST,$_COOKIE,$_FILES. Other superglobals are returned only if they have been used somewhere in the code. This is because of the [auto_globals_jit](<http://php.net/manual/en/ini.core.php#ini.auto-globals-jit>) directive which is enabled by default. When it’s enabled, the $_SERVER and $_ENV variables are created when they’re first used (Just In Time) instead of when the script starts. If these variables are not used within a script, having this directive on will result in a performance gain.