You are here

function variable_global_set in Variable 6

Switch global variable

Parameters

$name: Optional global variable name. If not set, it will reset all global variables to its original value.

$value: Optional new value for global variable. If not set, it will reset the variable to its original value.

File

./variable.module, line 144
Variable API module

Code

function variable_global_set($name, $value = NULL) {
  $original =& variable_static('variable_global', array());
  if (!isset($original[$name])) {
    $original[$name] = $GLOBALS[$name];
  }
  if (isset($value)) {
    $GLOBALS[$name] = $value;
  }
}