3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php try { $f = function () { $a = 1; yield from $a; }; foreach($f() as $var) { var_dump($var); } } catch(Throwable $e) { var_dump($e); }
based on l7mCG
Output for 7.0.0 - 7.2.0
object(Error)#4 (7) { ["message":protected]=> string(54) "Can use "yield from" only with arrays and Traversables" ["string":"Error":private]=> string(0) "" ["code":protected]=> int(0) ["file":protected]=> string(9) "/in/riXJp" ["line":protected]=> int(7) ["trace":"Error":private]=> array(1) { [0]=> array(4) { ["file"]=> string(9) "/in/riXJp" ["line"]=> int(9) ["function"]=> string(9) "{closure}" ["args"]=> array(0) { } } } ["previous":"Error":private]=> NULL }
Output for 5.5.24 - 5.6.28
Parse error: syntax error, unexpected '$a' (T_VARIABLE) in /in/riXJp on line 7
Process exited with code 255.
Output for 5.4.11 - 5.4.45
Parse error: syntax error, unexpected 'from' (T_STRING) in /in/riXJp on line 7
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/riXJp on line 7
Process exited with code 255.