3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php try { $pdo = new PDO("mysql:host=54.186.245.96;port=3306;dbname=pdotest", "pdotestuser", "pdotestpass"); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $pdo->query("INSERT INTO fake_table VALUES ('bogus')"); } catch (PDOException $e) { var_dump($e->getCode()); var_dump($e->getMessage()); }
based on ILrQe
Output for 5.1.0 - 7.2.0
int(0) string(21) "could not find driver"
Output for 5.0.0 - 5.0.5
Fatal error: Class 'PDO' not found in /in/7QHbB on line 4
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected '{' in /in/7QHbB 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/7QHbB on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/7QHbB on line 3
Process exited with code 255.