3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function get_odds($from, $to) { for ($i=$from; $i<=100; $i+=2) yield $i;} foreach (get_odds() as $val) echo "$val\n";
Output for 7.1.0
Fatal error: Uncaught ArgumentCountError: Too few arguments to function get_odds(), 0 passed in /in/R5u4g on line 3 and exactly 2 expected in /in/R5u4g:2 Stack trace: #0 /in/R5u4g(3): get_odds() #1 {main} thrown in /in/R5u4g on line 2
Process exited with code 255.
Output for 7.0.0 - 7.0.14
Warning: Missing argument 1 for get_odds(), called in /in/R5u4g on line 3 and defined in /in/R5u4g on line 2 Warning: Missing argument 2 for get_odds(), called in /in/R5u4g on line 3 and defined in /in/R5u4g on line 2 Notice: Undefined variable: from in /in/R5u4g on line 2 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100
Output for 5.5.24 - 5.6.28
Warning: Missing argument 1 for get_odds() in /in/R5u4g on line 2 Warning: Missing argument 2 for get_odds() in /in/R5u4g on line 2 Notice: Undefined variable: from in /in/R5u4g on line 2 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100
Output for 5.4.0 - 5.4.45
Parse error: syntax error, unexpected '$i' (T_VARIABLE) in /in/R5u4g on line 2
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected T_VARIABLE in /in/R5u4g on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_VARIABLE in /in/R5u4g on line 2
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/R5u4g on line 2
Process exited with code 255.