K2hQueue::count
Counts elements in the K2hQueue object
Description
public intfalseK2hQueue::count ( void )
Counts the number of elements in the K2hQueue object.
Parameters
This function has no parameters.
Return Values
Returns the number of elements in the K2hQueue.
Examples
- Example 1 - Gets a element from K2hQueue
<?php
$handle = k2hpx_open_mem();
$k2hqueue = new K2hQueue($handle, true, "test_queue_");
var_dump($k2hqueue->count());
$k2hqueue->push("test_queue_data");
var_dump($k2hqueue->count());
var_dump($k2hqueue->pop());
var_dump($k2hqueue->count());
unset($k2hqueue);
k2hpx_close($handle);
?>
The above example will output:
int(0)
int(1)
string(15) "test_queue_data"
int(0)
See Also
- K2hQueue::pop - Removes and returns the removed element from the K2hQueue
- K2hQueue::push - Adds a value to the K2hQueue