4.6.x bootstrap.inc variable_set($name, $value)
4.7.x bootstrap.inc variable_set($name, $value)
5.x bootstrap.inc variable_set($name, $value)
6.x bootstrap.inc variable_set($name, $value)
7.x bootstrap.inc variable_set($name, $value)

Set a persistent variable.


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

37 calls to variable_set()
block_example_block in developer/examples/block_example.module
Implementation of hook_block().
cache_clear_all in includes/bootstrap.inc
Expire data from the cache.
cache_get in includes/bootstrap.inc
Return data from the persistent cache.
cron.php in ./cron.php
Handles incoming requests to fire off regularly-scheduled tasks (cron jobs).
drupal_get_private_key in includes/common.inc
Ensure the private key variable used to generate tokens is set.

... See full list


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


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

  db_query("DELETE FROM {variable} WHERE name = '%s'", $name);
  db_query("INSERT INTO {variable} (name, value) VALUES ('%s', '%s')", $name, serialize($value));


  $conf[$name] = $value;