K2hdkc::clearSubkey
Removes all subkeys of the key
Description
public function clearSubkeys(
string $key): bool {}
Removes all subkeys of the key.
Parameters
- key
Specify the key to remove all subkeys
Return Values
Returns true
on success or false
on failure.
Examples
- Example 1 - Adds a subkey to the key
$ php -r '
$handle = new K2hdkc("./tests/slave.ini");
var_dump($handle->setValue("key1", "val1"));
$handle->addSubkey("key1", "key2", "val2");
var_dump($handle->getSubkeys("key1"));
var_dump($handle->clearSubkeys("key1"));
var_dump($handle->getSubkeys("key1"));
'
The above example will output:
bool(true)
array(1) {
[0]=>
string(4) "key2"
}
bool(true)
array(0) {
}
See Also
- K2hdkc::addSubkey - Adds a subkey to the key
- K2hdkc::clearSubkeys - Removes all subkeys of the key
- K2hdkc::getSubkeys - Gets all subkeys of the key