K2hash::getIterator
Gets a K2hIterator object
Description
public mixed K2hash::getIterator ( string $key )
Gets a K2hIterator object that points to the first element of keys. K2hIterator is a class to handle the array of k2hash keys.
Parameters
- key
Specifies the key to search for in the array of k2hash keys.
Return Values
Returns a K2hIterator object.
Examples
- Example 1 - Gets a K2hIterator object
<?php
$k2hash = new K2hash();
$k2hash->openMem();
$k2hash->setValue("test1", "value1");
$k2hash->setValue("test2", "value2");
$k2hash->setValue("test3", "value3");
$iterator = $k2hash->getIterator();
$count = 0;
foreach($iterator as $val){
$count++;
}
echo $count;
?>
The above example will output:
3
See Also
- K2hIterator::__construct - Creates a K2hIterator instance