3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gen() { $i = 0; $i = &$i; yield $i; var_dump($i); return $i; } $gen = gen(); var_dump($gen->current()++);
Output for 5.5.24 - 5.5.29, 5.6.8 - 5.6.13
Fatal error: Generators cannot return values using "return" in /in/5bA3a on line 11
Process exited with code 255.
Output for 5.4.2 - 5.4.45
Parse error: syntax error, unexpected '$i' (T_VARIABLE) in /in/5bA3a on line 7
Process exited with code 255.

preferences:
191.78 ms | 1395 KiB | 62 Q