Skip to content

Instantly share code, notes, and snippets.

@assertchris
Created December 4, 2012 10:45
Show Gist options
  • Select an option

  • Save assertchris/4202584 to your computer and use it in GitHub Desktop.

Select an option

Save assertchris/4202584 to your computer and use it in GitHub Desktop.
ArrayIterator with ->previous()
class ArrayIterator extends \ArrayIterator
{
protected $_previous;
public function next()
{
$this->_previous = $this->key();
parent::next();
}
public function previous()
{
$this->seek($this->_previous);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment