3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo($v) { if ($v !== 2) { return $v; } throw new Exception('something bad happened'); } $data = array(1, 2, 3); set_error_handler(function ($level, $err) { echo $err; return false; }); try { var_dump(array_map('foo', $data)); } catch (Exception $e) { var_dump($e->getMessage()); }

preferences:
37.29 ms | 402 KiB | 5 Q