K2hash::addSubkey
Associates the key with the other key
Description
public bool K2hash::addSubkey ( string $key , string $subkey )
Associates the key 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
- key
Specifies the key that link with the subkey. - subkey
Specifies the subkey that link with the key.
Return Values
Returns true on success or false on failure.
Examples
- Example 1 - Adds the subkey to the key
<?php
$k2hash = new K2hash();
$k2hash->openMem();
$k2hash->addSubkey("test", "sub");
var_dump($k2hash->getSubkeys("test"));
$k2hash->close();
?>
The above example will output:
array(1) {
[0]=>
string(3) "sub"
}
See Also
- K2hash::addSubkeys - Adds the subkeys to the key
- K2hash::getSubkeys - Gets an array of keys associated with the key