3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class it implements OuterIterator { private $inner; public function __construct(Iterator $inner) { $this->inner = $inner; } public function getInnerIterator() { echo "++ inner\n"; return $this->inner; } public function next() { echo "-- Next\n"; return $this->inner->next(); } public function current() { echo "-- Current\n"; return $this->inner->current(); } public function key() { echo "-- Key\n"; return $this->inner->key(); } public function rewind() { echo "-- Rewind\n"; return $this->inner->rewind(); } public function valid() { echo "-- Valid\n"; return $this->inner->valid(); } } $it = new it(new ArrayIterator(array("foo", "bar"))); forach ($it as $key => $value) { echo $value."\n"; }
Output for 7.0.0
Parse error: syntax error, unexpected 'as' (T_AS), expecting ',' or ')' in /in/u3TX2 on line 46
Process exited with code 255.
Output for 5.4.10 - 5.6.16
Parse error: syntax error, unexpected 'as' (T_AS) in /in/u3TX2 on line 46
Process exited with code 255.
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected T_AS in /in/u3TX2 on line 46
Process exited with code 255.