3v4l.org

run code in 200+ PHP versions simultaneously
<?php $iterator = new \AppendIterator(); $events = new \ArrayIterator([1,2,3,4,5]); $iterator->append($events); $events->next(); while($iterator->valid()) { echo $iterator->current(), "\n"; $iterator->next(); }
Output for 7.1.15 - 7.1.25, 7.2.3 - 7.3.1
2 3 4 5
Output for 5.4.0 - 7.1.14, 7.2.0 - 7.2.2
1 3 4 5
Output for 5.3.0 - 5.3.29
Parse error: syntax error, unexpected '[', expecting ')' in /in/EavLv on line 4
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/EavLv on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/EavLv on line 4 Parse error: syntax error, unexpected '[', expecting ')' in /in/EavLv on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/EavLv on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/EavLv on line 4 Parse error: parse error, unexpected '[', expecting ')' in /in/EavLv on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/EavLv on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/EavLv on line 4 Parse error: parse error, expecting `')'' in /in/EavLv on line 4
Process exited with code 255.