3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace CatsMakeTerriblePets; function GimmeTehPDOz ($access, $host, $dbname, $port, $user, $pass) { // Set DSN $dsn = $access.':host=' . $host . ';dbname=' . $dbname. ';port=' . $port; // Set options $options = array( \PDO::ATTR_PERSISTENT => true, \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION ); $dbh = false; $error = false; // Create a new PDO instanace try{ $dbh = new \PDO($dsn, $user, $pass, $options); } // Catch any errors catch(\PDOException $e){ $error = $e->getMessage(); } if (!$dbh) return $error; return $dbh; } $dbh = GimmeTehPDOz('', 'localhost', 'mysql', '3306', 'root', ''); var_dump($dbh);
Output for git.master, git.master_jit, rfc.property-hooks
string(21) "could not find driver"

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:
108.47 ms | 405 KiB | 5 Q