Hash functions - hdijkema/espocrm-hookedformulas GitHub Wiki
HASH = Hash\New()
Creates a Hash variable.
HASH_NEW = Hash\Set(HASH, KEY, VALUE)
Stores the KEY/VALUE pair in HASH and returns the newly created HASH. Note! If you don't assign HASH_NEW, this function is a NO-OP!
Example:
$h = Hash\New();
$h = Hash\Set($h, 'key', 1);
VALUE = Hash\Get(HASH, KEY)
Returns the VALUE of KEY in the HASH, or null if none exists.
Example:
$h = Hash\New();
$h = Hash\Set($h, 'key', 1);
$v = Hash\Get($h, 'key');
BOOL = Hash\Isset(HASH, KEY)
Returns the if KEY is set in HASH.
Example:
$h = Hash\New();
$h = Hash\Set($h, 'key', 1);
ifThen(Hash\Isset($h, 'not-in-hash'),
logAdd(log, 'This is a surprise!');
);
$v = Hash\Get($h, 'key');
HASH_NEW = Hash\Usset(HASH, KEY)
Clears the VALUE for KEY in HASH. Note! If you don't assign HASH_NEW, this function is a NO-OP!
Example:
$h = Hash\New();
$h = Hash\Set($h, 'key', 1);
$h = Hash\Unset($h, 'key')
ifThen(Hash\Isset($h, 'key'),
logAdd(log, 'This is also a surprise!');
);
$v = Hash\Get($h, 'key'); // returns an empty (null) value
HASH_NEW = Hash\Copy(HASH)
Copies the given hash to a new Hash.
Example:
$h = Hash\New();
$h = Hash\Set($h, 'key', 1);
$nh= Hash\Copy($h);