K2hdkc::rename
Renames a pair of the key/value
Description
public function rename(
string $key,
string $new_key,
string $parent_key = null,
bool $is_check_attr = true,
string $password = null,
int $expiration_duration = 0): bool {}
Renames a pair of the key/value.
Parameters
- key
Specify the key. - new_key
Specify the new key. - parent_key
Specify the parent key. - is_check_attr
Specifytrue
to check the passphrase and expiration of the parent key. - password
Specify the password that is associated with the key. - expiration_duration
Specify the expiration duration in seconds.
Return Values
Returns true
on success or false
on failure.
Examples
- Example 1 - Renames a key
$ php -r '
$k2hdkc = new K2hdkc("./tests/slave.ini");
var_dump($k2hdkc->setValue("key1", "val1"));
var_dump($k2hdkc->getValue("key1"));
var_dump($k2hdkc->rename("key1", "key2"));
var_dump($k2hdkc->getValue("key2"));
'
The above example will output:
bool(true)
string(4) "val1"
bool(true)
string(4) "val1"
See Also
- K2hdkc::getValue - Gets a value of the key
- K2hdkc::setValue - Sets a pair of the key/value