| Package | system.collections |
|---|---|
| Inheritance | class CMapIterator |
| Implements | Iterator, Traversable |
| Since | 1.0 |
| Version | $Id$ |
| Source Code | framework/collections/CMapIterator.php |
| Method | Description | Defined By |
|---|---|---|
| __construct() | Constructor. | CMapIterator |
| current() | Returns the current array element. | CMapIterator |
| key() | Returns the key of the current array element. | CMapIterator |
| next() | Moves the internal pointer to the next array element. | CMapIterator |
| rewind() | Rewinds internal array pointer. | CMapIterator |
| valid() | Returns whether there is an element at current position. | CMapIterator |
|
public void __construct(array &$data)
| ||
| $data | array | the data to be iterated through |
public function __construct(&$data)
{
$this->_d=&$data;
$this->_keys=array_keys($data);
}
Constructor.
|
public mixed current()
| ||
| {return} | mixed | the current array element |
public function current()
{
return $this->_d[$this->_key];
}
Returns the current array element. This method is required by the interface Iterator.
|
public mixed key()
| ||
| {return} | mixed | the key of the current array element |
public function key()
{
return $this->_key;
}
Returns the key of the current array element. This method is required by the interface Iterator.
|
public void next()
|
public function next()
{
$this->_key=next($this->_keys);
}
Moves the internal pointer to the next array element. This method is required by the interface Iterator.
|
public void rewind()
|
public function rewind()
{
$this->_key=reset($this->_keys);
}
Rewinds internal array pointer. This method is required by the interface Iterator.
|
public boolean valid()
| ||
| {return} | boolean | |
public function valid()
{
return $this->_key!==false;
}
Returns whether there is an element at current position. This method is required by the interface Iterator.
Signup or Login in order to comment.