MENU
Accessing Global Variables
$GLOBALS[s] provides a means to manipulate global variables directly in functions.RESETRUNFULL
<!DOCTYPE html>
<html>
<head></head>
<body><?php
function f(){
$v=1;
echo $v; // 1, local variable
echo $GLOBALS['v']; // 2, global variable
$GLOBALS['w']=3;
unset($GLOBALS['v']); // global variables can now be unset
}
$v=2;
f();
echo $w; // 3, global variable
echo $v; // Notice, already unset
?> </body>
</html>