K2hash::putArchive K2hash Class K2hash::removeAll

K2hash::remove

Removes the key

Description

 public bool K2hash::remove ( string $key [, string $subkey ] )

Removes the key.

Parameters

Return Values

Returns true on success or false on failure.

Examples

<?php
$k2hash = new K2hash();
$k2hash->openMem();
$k2hash->setValue("test1", "value");
$k2hash->setValue("sub1", "sub-value");
$k2hash->addSubkey("test1", "sub1");

$k2hash->remove("test1");
var_dump($k2hash->getValue("test1"));
var_dump($k2hash->getValue("sub1"));
?>

The above example will output:

bool(false)
string(9) "sub-value"
<?php
$k2hash = new K2hash();
$k2hash->openMem();
$k2hash->setValue("test1", "value");
$k2hash->setValue("sub1", "sub-value");
$k2hash->addSubkey("test1", "sub1");
$k2hash->remove("test1", "sub1");
var_dump($k2hash->getValue("test1"));
var_dump($k2hash->getValue("sub1"));
?>

The above example will output:

string(5) "value"
bool(false)

See Also

K2hash::putArchive K2hash Class K2hash::removeAll