Hi. Using CMapIterator is a little annoying because of one thing - I always have to rewind before use.
$t = new CMap(array('1','2','3'));
$k=$t->getIterator();
echo var_export($k->current(),1);
will produce NULL
$t = new CMap(array('1','2','3'));
$k=$t->getIterator();
$k->rewind();
// now we are ready to go
echo var_export($k->current(),1);
will produce 1 of course. So, u cant work with your iterator since u rewind it first.
Just one change in constructor’d make me more happy:
public function __construct(&$data)
{
$this->_d=&$data;
$this->_keys=array_keys($data);
$this->rewind(); // we do rewind after all properties are established to find out the current (first element)
}
tx.