The MyIterator::valid() method above ist bad, because it
breaks on entries with 0 or empty strings, use key() instead:
<?php
public function valid()
{
return ! is_null(key($this->var));
}
?>
read about current() drawbacks:
http://php.net/current