This is my solution for problem with offsetUnset
<?php
$a = new ArrayObject( range( 0,9 ) );
$b = new ArrayIterator( $a );
for ( $b->rewind(); $b->valid(); )
{
echo "#{$b->key()} - {$b->current()} - <br>\r\n";
if($b->key()==0 || $b->key()==1){
$b->offsetUnset( $b->key() );
}else {
$b->next();
}
}
var_dump($b);
?>