3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php try { $a = 2 / 0; // connect to database here } catch (PDOException $e) { // exception was a database exception echo 'Database error', $e->getMessage(); } catch (Exception $e) { // exception was a general exception echo 'General error', $e->getMessage(); }
Output for 5.1.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Warning: Division by zero in /in/bdE3Q on line 4
Output for 5.0.0 - 5.0.5
Warning: Division by zero in /in/bdE3Q on line 4 Fatal error: Class 'PDOException' not found in /in/bdE3Q on line 6
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected '{' in /in/bdE3Q on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected '{' in /in/bdE3Q on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/bdE3Q on line 3
Process exited with code 255.