All pastes #829468 Raw Edit

;)

public php v1 · immutable
#829468 ·published 2007-12-23 05:06 UTC
rendered paste body
<?phpclass AlphabetIterator extends FilterIterator{	private		$letter;	function __construct(array $array, $letter)	{		parent::__construct(new ArrayIterator($array));		$this -> 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;}?>