3v4l.org

run code in 500+ PHP versions simultaneously
<?php class MyDbException extends Exception {} class DB { public function __construct() { $this->checkConnection(); } public function checkConnection() { try { $this->connect(); } catch (PDOException $e) { throw new MyDbException('Error during connection check', 42, $e); } } public function connect() { // Здесь будет подключение к Oracle DB через PDO throw new PDOException("SQLSTATE[28000] [1045] Access denied for user 'user'@'example.com' (using password: YES)"); } } function connectToDb() { try { $db = new DB; // ... } catch (MyDbException $e) { echo $e->getMessage(), ':', PHP_EOL, $e->getPrevious()->getMessage(), PHP_EOL; } catch (Exception $e) { echo $e->getMessage(), PHP_EOL; } } connectToDb();
Output for git.master, git.master_jit, rfc.property-hooks
Error during connection check: SQLSTATE[28000] [1045] Access denied for user 'user'@'example.com' (using password: YES)

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
50.73 ms | 1509 KiB | 4 Q