Skip to content
elplatt edited this page Jan 4, 2013 · 1 revision

The variable module allows any other module to save or retrieve strings from the database.

To save a string, use the following:

variable_set($name, $value);

To retrieve a string, use the following (a default value will be used if it is not in the database):

variable_get($name, $default);

Example:

print variable_get('foo', '42');
variable_set('foo', '1337');
print variable_get('foo', '42');

Will print:

42
1337