K2hdkc::removeSubkeys
Removes subkeys
Description
public function removeSubkeys(
string $key,
array $subkeys,
bool $nested = false): bool {}
Removes subkeys.
Parameters
- key
Specify the key. - subkey
Specify the subkeys that is associated with the key. - nested
Specifytrue
if remove subkeys recursively.
Return Values
Returns true
on success or false
on failure.
Examples
- Example 1 - Removes a subkeys
$ php -r '
$k2hdkc = new K2hdkc("./tests/slave.ini");
$k2hdkc->addSubkey("test", "sub1", "subv1");
$k2hdkc->addSubkey("test", "sub2", "subv2");
var_dump($k2hdkc->getSubkeys("test"));
var_dump($k2hdkc->removeSubkeys("test", array("sub1")));
var_dump($k2hdkc->getSubkeys("test"));
$k2hdkc->close();
'
The above example will output:
array(2) {
[0]=>
string(4) "sub1"
[1]=>
string(4) "sub2"
}
bool(true)
array(1) {
[0]=>
string(4) "sub2"
}
See Also
- K2hdkc::addSubkey - Adds a subkey to the key
- K2hdkc::getSubkeys - Gets all subkeys of the key