3v4l.org

run code in 300+ PHP versions simultaneously
<?php $success=false; if (true){ set_error_handler(function($a, $b, $c, $d) { var_dump('error_handler', $a, $b, $c, $d); }); register_shutdown_function(function()){ if ($success){return;} var_dump(get_last_error()); }); } $var = 1; try { $var->method(); // Throws an Error object in PHP 7. } catch (Error $e) { // Handle error var_dump('error', $e); } catch (Exception $e) { // Handle error var_dump('exception', $e); } $success=true; ?>
Output for 5.5.24 - 5.5.30, 5.6.8 - 5.6.16
Parse error: syntax error, unexpected ')', expecting '{' in /in/h8t0P on line 7
Process exited with code 255.

preferences:
164.16 ms | 1395 KiB | 23 Q