variable_set
- Versions
- 4.6 – 7
variable_set($name, $value)
Set a persistent variable.
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.
Code
includes/bootstrap.inc, line 464
<?php
function variable_set($name, $value) {
global $conf;
db_lock_table('variable');
db_query("DELETE FROM {variable} WHERE name = '%s'", $name);
db_query("INSERT INTO {variable} (name, value) VALUES ('%s', '%s')", $name, serialize($value));
db_unlock_tables();
cache_clear_all('variables', 'cache');
$conf[$name] = $value;
}
?>Login or register to post comments 