K2hKeyQueue::count
Counts elements in the K2hKeyQueue object
Description
public int K2hKeyQueue::count ( void )
Counts the number of elements in the K2hKeyQueue object.
Parameters
This function has no parameters.
Return Values
Returns the number of elements in the K2hKeyQueue.
Examples
- Example 1 - Counts elements from K2hKeyQueue
<?php
$handle = k2hpx_open_mem();
$k2hkeyqueue = new K2hKeyQueue($handle, true, "test_queue_");
var_dump($k2hkeyqueue->count());
$k2hkeyqueue->push("test_queue_key", "test_queue_value");
var_dump($k2hkeyqueue->count());
var_dump($k2hkeyqueue->pop());
var_dump($k2hkeyqueue->count());
unset($k2hkeyqueue);
k2hpx_close($handle);
?>
The above example will output:
int(0)
int(1)
array(2) {
[0]=>
string(14) "test_queue_key"
[1]=>
string(16) "test_queue_value"
}
int(0)