3v4l.org

run code in 300+ PHP versions simultaneously
<?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()); }

preferences:
43.32 ms | 402 KiB | 5 Q