K2hKeyQueue::remove
Removes a key/value pair from the K2hKeyQueue
Description
public bool K2hKeyQueue::remove ( int $count [, string $pass ] )
Removes a key/value pair from the K2hKeyQueue.
Parameters
- count
Specifies the number of elements to remove. - pass
Specifies the password to decrypt the value.
Return Values
Returns true on success or false on failure.
Examples
- Example 1 - Gets an element from a K2hKeyQueue instance
<?php
$handle = k2hpx_open_mem();
$k2hkeyqueue = new K2hKeyQueue($handle, true, "test_queue_");
$k2hkeyqueue->push("test_queue_key1", "test_queue_value1");
$k2hkeyqueue->push("test_queue_key2", "test_queue_value2");
var_dump($k2hkeyqueue->count());
var_dump($k2hkeyqueue->remove(1));
var_dump($k2hkeyqueue->count());
unset($k2hkeyqueue);
k2hpx_close($handle);
?>
The above example will output:
int(2)
bool(true)
int(1)
See Also
- K2hKeyQueue::pop - Removes and returns the removed element from the K2hKeyQueue
- K2hKeyQueue::push - Adds a key/value pair to the K2hKeyQueue
- K2hKeyQueue::read - Returns a key/value pair from the K2hKeyQueue