3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class Singleton { public static function getInstance() { static $instance = null; if (null === $instance) { $instance = new static(); } return $instance; } abstract protected function __construct(){} // prevent new instances using "new" final private function __clone(){} // prevent cloning final private function __wakeup(){} // prevent unserializing } class odb extends Singleton { /*** Credentials ***/ private $sPDOHost = 'localhost'; private $sPDOUser = 'username'; private $sPDOPass = 'password'; private $sPDODB = 'database'; /*** Main Constructor ***/ private function __construct() { /*try { $this->oPDO = new PDO('mysql:host=' . $this->sPDOHost . ';' . 'dbname=' . $this->sPDODB, $this->sPDOUser, $this->sPDOPass); } catch (PDOException $oEx) { die('MySQL/PDO Connection failed: <br /><pre>' . $oEx->getMessage() . "</pre>"); return false; }*/ echo "hi"; } } $Test = odb::getInstance(); ?>

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
5.4.290.0100.03812.51
5.4.280.0120.03412.38
5.4.270.0110.06612.38
5.4.260.0060.05812.38
5.4.250.0060.04612.38
5.4.240.0080.04212.38
5.4.230.0100.04112.37
5.4.220.0060.04212.37
5.4.210.0050.04912.37
5.4.200.0110.05412.37
5.4.190.0140.06312.36
5.4.180.0080.04312.37
5.4.170.0380.05212.38
5.4.160.0190.07812.37
5.4.150.0340.09512.37
5.4.140.0150.05212.05
5.4.130.0300.08212.04
5.4.120.0170.07712.00
5.4.110.0090.06812.00
5.4.100.0120.06111.99
5.4.90.0140.06711.99
5.4.80.0130.06211.99
5.4.70.0110.05611.99
5.4.60.0090.04011.99
5.4.50.0110.03811.99
5.4.40.0050.04711.98
5.4.30.0090.04011.97
5.4.20.0110.06311.98
5.4.10.0080.03711.98
5.4.00.0050.03811.47
5.3.280.0070.04112.71
5.3.270.0090.04712.73
5.3.260.0050.05012.72
5.3.250.0050.04512.72
5.3.240.0110.04512.72
5.3.230.0120.03912.71
5.3.220.0080.04312.68
5.3.210.0060.04512.68
5.3.200.0120.04312.68
5.3.190.0090.04112.67
5.3.180.0090.04012.68
5.3.170.0110.04012.67
5.3.160.0100.04012.68
5.3.150.0070.04312.67
5.3.140.0230.04012.66
5.3.130.0080.04612.66
5.3.120.0280.04412.66
5.3.110.0070.05512.66
5.3.100.0110.04012.12
5.3.90.0140.04412.09
5.3.80.0120.06112.07
5.3.70.0140.06112.08
5.3.60.0180.07312.06
5.3.50.0120.06012.00
5.3.40.0160.06512.00
5.3.30.0110.06111.95
5.3.20.0150.03911.74
5.3.10.0110.04311.70
5.3.00.0230.04611.69

preferences:
142.53 ms | 1394 KiB | 7 Q