letter = $letter; } function accept() { $current = $this -> current(); return strlen($current) && ($current[0] === $this -> letter); } } $list = array('alpha', 'beta', 'bar', 'baz', 'foo', 'blaz'); $list = new IteratorIterator(new AlphabetIterator($list, 'b')); foreach($list as $word) { echo $word; } ?>