K2hash::addSubkey K2hash Class K2hash::cleanCommonAttribute

K2hash::addSubkeys

Adds the subkeys to the key

Description

public bool K2hash::addSubkeys ( string $key , array $subkeys )

Associates the keys with the other key. The key that is added to the other key is called ‘subkey’. The key that adds the other key to is ‘parent key’. A parent key can associates many subkeys.

Parameters

Return Values

Returns true on success or false on failure.

Examples

<?php
$k2hash = new K2hash();
$k2hash->openMem();
$k2hash->addSubkeys("test", array("subkey1", "subkey2", "subkey3"));
var_dump($k2hash->getSubkeys("test"));
$k2hash->close();
?>

The above example will output:

array(3) {
  [0]=>
  string(7) "subkey1"
  [1]=>
  string(7) "subkey2"
  [2]=>
  string(7) "subkey3"
}

See Also

K2hash::addSubkey K2hash Class K2hash::cleanCommonAttribute