3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function foo() { $foo = (yield 'strlen' => ['a']); $foo .= (yield 'strlen' => ['ab']); $foo .= (yield 'strlen' => ['abc']); yield $foo."final"; } function call_generator_function($g) { $args = $g->current(); $callable = $g->key(); while ($g->valid() && is_callable($callable)) { $return = call_user_func_array($callable, $args); $g->send($return); $args = $g->current(); $callable = $g->key(); } return $args; } $result = call_generator_function(foo()); var_dump($result); var_dump((yield 'strlen' => ['a'])));
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.4.0 - 5.4.34
Parse error: syntax error, unexpected ''strlen'' (T_CONSTANT_ENCAPSED_STRING) in /in/oioRe on line 5
Process exited with code 255.
Output for 5.3.0 - 5.3.29
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /in/oioRe on line 5
Process exited with code 255.