K2hash::rename
Renames the key
Description
public bool K2hash::rename ( string $key , string $newkey )
Renames the key
Parameters
- key
Specifies the old key name. - newkey
Specifies the new key name.
Return Values
Returns true on success or false on failure.
Examples
- Example 1 - Renames a key
<?php
$k2hash = new K2hash();
$k2hash->openMem();
$k2hash->setValue("test1", "value");
var_dump($k2hash->rename("test1", "test2"));
var_dump($k2hash->getValue("test2"));
?>
The above example will output:
bool(true)
string(5) "value"
See Also
- K2hash::getValue - Gets the value associated with the key
- K2hash::setValue - Sets the value associated with the key