3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php register_tick_function(function () { echo "Tick", PHP_EOL; throw new \Exception("Software interrupt"); }); declare(ticks=1e2) { try { $loopIndex = 0; while ($loopIndex < 1e3) { $loopIndex++; echo "Index {$loopIndex}", PHP_EOL; } } catch (\Exception $e) { echo "Received termination signal"; } }
Output for 5.3.0 - 5.6.11, 7.0.0 - 7.1.0
Index 1 Index 2 Index 3 Index 4 Index 5 Index 6 Index 7 Index 8 Index 9 Index 10 Index 11 Index 12 Index 13 Index 14 Index 15 Index 16 Index 17 Index 18 Index 19 Index 20 Index 21 Index 22 Index 23 Index 24 Index 25 Index 26 Index 27 Index 28 Index 29 Index 30 Index 31 Index 32 Index 33 Tick Received termination signal
Output for hhvm-3.12.0

Process exited with code 139.
Output for hhvm-3.10.0
Fatal error: Call to undefined function register_tick_function() in /in/lm5lI on line 3
Process exited with code 255.
Output for 5.6.12 - 5.6.28
Index 1 Index 2 Index 3 Index 4 Index 5 Index 6 Index 7 Index 8 Index 9 Index 10 Index 11 Index 12 Index 13 Index 14 Index 15 Index 16 Index 17 Index 18 Index 19 Index 20 Index 21 Index 22 Index 23 Index 24 Index 25 Index 26 Index 27 Index 28 Index 29 Index 30 Index 31 Index 32 Index 33 Index 34 Index 35 Index 36 Index 37 Index 38 Index 39 Index 40 Index 41 Index 42 Index 43 Index 44 Index 45 Index 46 Index 47 Index 48 Index 49 Tick Received termination signal
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /in/lm5lI on line 3
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_FUNCTION, expecting ')' in /in/lm5lI on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/lm5lI on line 3
Process exited with code 255.