3v4l.org

run code in 300+ PHP versions simultaneously
<?php register_tick_function(function () { echo "Tick", PHP_EOL; throw new \Exception("Software interrupt"); }); /*declare(ticks=1) */{ try { $loopIndex = 0; while ($loopIndex < 1e3) { $loopIndex++; echo "Index {$loopIndex}", PHP_EOL; } } catch (\Exception $e) { echo "Received termination signal"; } }

preferences:
37.63 ms | 402 KiB | 5 Q