Home >> PHP >> $GLOBALS super global variable in PHP

$GLOBALS super global variable in PHP

$GLOBALS is a super global variable which is used to access global variables from anywhere in the PHP script(within function).

Syntax

$GLOBALS['name']

Example

$a=10;

function testGlobal(){

           echo $GLOBALS['a'];

}

Output

10

Post Your Comment

Next Questions
$_SERVER super global variable
$_REQUEST super global variable
$_POST super global variable
$_GET super global variable
$_FILES super global variable
$_ENV super global variable
$_COOKIE super global variable
$_SESSION super global variable
Ternary operator
Variable types
What is password encrypt and decrypt function
Difference between echo and print
How can destroy and unset the variable of a session
Function
isset() function
unset() function
empty() function
What are function for controlling script execution
exit() function
die() function
fun_num_args() function
ereg_replace() function
ereg_ireplace() function
preg_match() function
preg_replace() function

Copyright ©2022 coderraj.com. All Rights Reserved.