K2hKeyQueue::read
Returns a key/value pair from the K2hKeyQueue
Description
public arrayfalseK2hKeyQueue::read ([ int $pos [, string $pass ]] )
Returns a key/value pair from the K2hKeyQueue.
Note
This operation will not remove the element from the K2hKeyQueue. Use K2hKeyQueue::pop to removes and returns the element instead.
Parameters
- pos
Specifies the position of the K2hKeyQueue. - pass
Specifies the password to decrypt the value.
Return Values
Returns a key/value pair.
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_key", "test_queue_value");
var_dump($k2hkeyqueue->read(0));
unset($k2hkeyqueue);
k2hpx_close($handle);
?>
The above example will output:
array(2) {
[0]=>
string(14) "test_queue_key"
[1]=>
string(16) "test_queue_value"
}
See Also
- K2hKeyQueue::pop - Removes and returns the removed element from the K2hKeyQueue
- K2hKeyQueue::push - Adds a key/value pair to the K2hKeyQueue
- K2hKeyQueue::remove - Removes a key/value pair from the K2hKeyQueue