K2hash::addAttr
Adds the attribute to the key
Description
public bool K2hash::addAttr ( string $key , string $attrkey , string $attrval )
Adds the attribute to the key. Attributes represent configurations to keep timestamps of data modification, data encryptions or histories.
Parameters
- key
Specifies the key that links with the attribute. - attrkey
Specifies the name of the attribute. - attrval
Specifies the value of the attribute.
Return Values
Returns true on success or false on failure.
Examples
- Example 1 - Adds an attribute and get it
<?php
$k2hash = new K2hash();
$k2hash->openMem();
$k2hash->setValue("test", "value");
$k2hash->addAttr("test", "testattr", "testattrvalue");
var_dump($k2hash->getAttrValue("test", "testattr"));
$k2hash->close();
?>
The above example will output:
string(13) "testattrvalue"
See Also
- K2hash::addAttrCryptPass - Adds the password to encrypt values
- K2hash::addAttrPluginLib - Adds the user-defined library to handle attributes
- K2hash::cleanCommonAttribute - Initializes the common attributes
- K2hash::getAttrInfos - Prints the attribute information
- K2hash::getAttrs - Gets attributes of the key
- K2hash::getAttrValue - Gets an attribute value of the attribute key of the key
- K2hash::getAttrVersionInfos - Prints the attribute library version