function variable_set

cis7 bootstrap.inc variable_set($name, $value)
cle7 bootstrap.inc variable_set($name, $value)
elmsmedia7 bootstrap.inc variable_set($name, $value)
icor7 bootstrap.inc variable_set($name, $value)
meedjum_blog7 bootstrap.inc variable_set($name, $value)
mooc7 bootstrap.inc variable_set($name, $value)

Sets 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.

Parameters

$name: The name of the variable to set.

$value: The value to set. This can be any PHP data type; these functions take care of serialization as necessary.

See also

variable_del()

variable_get()

371 calls to variable_set()
addanother_update_7001 in sites/all/modules/ulmus/addanother/addanother.install
Port over to the new variable storage system.
admin_menu_toggle_modules in sites/all/modules/ulmus/admin_menu/admin_menu.inc
Menu callback; Enable/disable developer modules.
admin_theme_form_system_themes_form_alter_submit in sites/all/modules/ulmus/admin_theme/admin_theme.module
Process system_themes_form additions submissions.
advagg_cron in sites/all/modules/ulmus/advagg/advagg.module
Implements hook_cron().
advagg_css_compress_admin_settings_form_submit in sites/all/modules/ulmus/advagg/advagg_css_compress/advagg_css_compress.admin.inc
Clear out the advagg cache bin when the save configuration button is pressed.

... See full list

File

includes/bootstrap.inc, line 973
Functions that need to be loaded on every Drupal request.

Code

function variable_set($name, $value) {
  global $conf;

  db_merge('variable')->key(array('name' => $name))->fields(array('value' => serialize($value)))->execute();

  cache_clear_all('variables', 'cache_bootstrap');

  $conf[$name] = $value;
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.