3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php try { $x = new PDO('mysql:host=nope', 'meh', 'foo'); } catch(Exception $e) { var_dump($e->errorInfo); var_dump($e->getCode()); var_dump($e->getMessage()); }
based on YPViR
Output for 5.1.0 - 5.6.28, 7.0.0 - 7.1.0
NULL int(0) string(21) "could not find driver"
Output for hhvm-3.10.0 - 3.13.2
array(3) { [0]=> string(5) "HY000" [1]=> int(2005) [2]=> string(38) "Unknown MySQL server host 'nope' (111)" } string(5) "HY000" string(61) "SQLSTATE[HY000] [2005] Unknown MySQL server host 'nope' (111)"
Output for 5.0.0 - 5.0.5
Fatal error: Class 'PDO' not found in /in/VfB1k on line 2
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected '{' in /in/VfB1k on line 2
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/VfB1k on line 2
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/VfB1k on line 2
Process exited with code 255.