3v4l.org

run code in 300+ PHP versions simultaneously
<?php $g = function () { yield 1; yield 1; }; $gen = $g(); $refl = new ReflectionGenerator($gen); echo "Line: ", $refl->getExecutingLine(), PHP_EOL; $value = $gen->current(); var_dump($value); echo "Line: ", $refl->getExecutingLine(), PHP_EOL;
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
Line: 6 int(1) Line: 8
Output for 5.6.38
Fatal error: Class 'ReflectionGenerator' not found in /in/hskOD on line 13
Process exited with code 255.

preferences:
228.35 ms | 401 KiB | 218 Q