K2hIterator::__construct
Creates a K2hIterator instance
Description
public K2hIterator::__construct ( mixed $handle_res [, string $key ] )
Creates a K2hIterator instance. K2hIterator represents a pointer of an array of k2hash keys.
Parameters
- handle_res
Specifies the k2hash (.k2h
) file handle that k2hpx_open returns. - key
Specifies the key to search for.
Examples
- Example 1 - Gets a K2hIterator instance
<?php
$handle = k2hpx_open_mem();
k2hpx_set_value($handle, "test1", "value1");
$k2hiter = new K2hIterator($handle);
var_dump($k2hiter->key());
unset($k2hiter);
k2hpx_set_value($handle, "test1", "value1", "sub");
$k2hiter = new K2hIterator($handle, "test1");
var_dump($k2hiter->key());
unset($k2hiter);
?>
The above example will output:
string(5) "test1"
string(3) "sub"
See Also
- K2hash::getIterator - Gets a K2hIterator object