1 bootstrap.inc variable_get($name, $default = NULL)

Returns a persistent variable.

Case-sensitivity of the variable_* functions depends on the database collation used. To avoid problems, always use lower case for persistent variable names.

This function is deprecated in Backdrop and will be removed in a future release. Variables are not managed through the configuration system, so they cannot be moved between environments safely. If your module needs to save configuration settings, use config_get() instead. If you need to save an environment-specific setting (such as the last time cron ran), use state_get() instead.

Parameters

$name: The name of the variable to return.

$default: The default value to use if this variable has never been set.

Return value

The value of the variable. Unserialization is taken care of as necessary.:

Deprecated

since 1.0

See also

variable_del()

variable_set()

config_get()

state_get()

File

core/includes/bootstrap.inc, line 1268
Functions that need to be loaded on every Backdrop request.

Code

function variable_get($name, $default = NULL) {
  global $conf;

  watchdog_deprecated_function('bootstrap', __FUNCTION__);
  return isset($conf[$name]) ? $conf[$name] : $default;
}