2 "for" tag iterates over iterable objects
4 {% for item in items %}
6 * {{ loop.index }}/{{ loop.index0 }}
11 {% for key, value in items %}
12 * {{ key }}/{{ value }}
15 {% for key in items|keys %}
19 class ItemsIterator implements Iterator
21 protected $values = array('foo' => 'bar', 'bar' => 'foo');
22 public function current() { return current($this->values); }
23 public function key() { return key($this->values); }
24 public function next() { return next($this->values); }
25 public function rewind() { return reset($this->values); }
26 public function valid() { return false !== current($this->values); }
28 return array('items' => new ItemsIterator())