3v4l.org

run code in 300+ PHP versions simultaneously
<?php $i = new AppendIterator(); $i->append(new NoRewindIterator((fn ()=> yield 1)())); $i->append(new NoRewindIterator((fn ()=> yield 2)())); var_dump($i); var_dump(iterator_to_array($i));
Output for 7.4.0 - 7.4.16, 8.0.0 - 8.0.3
object(AppendIterator)#1 (0) { } array(1) { [0]=> int(2) }
Output for 7.3.0 - 7.3.27
Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW) in /in/sImTa on line 5
Process exited with code 255.