3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function lazyCall(callable $c) { $args = func_get_args(); yield $c(...$args); } function returnSome() { echo "Some", "\n"; yield "some"; } $g = lazyCall("returnSome"); echo "Foo"; $g->next(); echo "Bar"; $g->current()->next();
based on u8Luj
Output for 7.0.0 - 7.2.0
FooBar Fatal error: Uncaught Error: Call to a member function next() on null in /in/REOmR:17 Stack trace: #0 {main} thrown in /in/REOmR on line 17
Process exited with code 255.
Output for 5.6.8 - 5.6.28
FooBar Fatal error: Call to a member function next() on null in /in/REOmR on line 17
Process exited with code 255.
Output for 5.5.24 - 5.5.35
Parse error: syntax error, unexpected '.' in /in/REOmR on line 5
Process exited with code 255.
Output for 5.4.2 - 5.4.45
Parse error: syntax error, unexpected '$c' (T_VARIABLE) in /in/REOmR on line 5
Process exited with code 255.
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected T_VARIABLE in /in/REOmR on line 5
Process exited with code 255.