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 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
Line: 3 int(1) Line: 6
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.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30
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:
113.01 ms | 1624 KiB | 4 Q