All pastes #1742369 Raw Edit

Something

public php v1 · immutable
#1742369 ·published 2010-01-08 05:46 UTC
rendered paste body
<?phpclass SameKeyArray implements Iterator{	private $position = 0;	private $array = array();	private $key = '';	public function __construct( $arr, $key )	{		$this->position = 0;		$this->array = $arr;		$this->key = $key;	}	function rewind() {		$this->position = 0;	}	function current() {		return $this->array[$this->position];	}	function key() {		return $this->key;	}	function next() {		++$this->position;	}	function valid() {		return isset($this->array[$this->position]);	}}$years = new SameKeyArray(array(2007,2009), 'year');