3v4l.org

run code in 300+ PHP versions simultaneously
<?php $foo = [1, 2, 3, 4]; $arr = []; foreach($foo as $bar) { try { if($bar == 3) { throw new Exception("error: " + $bar); } $arr[] = $bar; } catch (Exception $e) { $arr[] = $e->getMessage(); } } echo implode($arr, ',');

preferences:
35.66 ms | 402 KiB | 5 Q