Skip to main content


hash_set — set an element in a hash


hash_set { hash } { key } { value }


This function sets a value in a hash table for a particular key. Hash keys must be strings (but can be expressions that resolve to strings), whereas hash values can be any valid Sieve value (string, number, stringlist or hashes).

**Configuration Change. ** This feature is available starting from Momentum 3.0.16.

Since 3.0.17, passing an incorrect value to this function returns an error message. Previously, no error was returned.

$hash = hash_create;
hash_set $hash "mykey" "myvalue";
$value = $hash["mykey"];

ec_log "The value is ${value}";

See Also

Was this page helpful?