3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class DbConnection { private $dsn; private $initializer; public function __construct(string $dsn) { $this->dsn = $dsn; // socket stuff happens here, much like with PDO } public function query(string $queryString) : array { ($this->initializer)(); // irrelevant from here on return ['query' => $queryString, 'dsn' => $this->dsn]; } public static function lazyInstance(string $dsn) : self { $instance = (new ReflectionClass(self::class))->newInstanceWithoutConstructor(); $instance->initializer = function () use ($dsn, $instance) { $instance->__construct($dsn); $instance->initializer = function () { }; }; return $instance; } } $instance = DbConnection::lazyInstance('mysql://something'); var_dump($instance); var_dump($instance->query('SELECT * FROM foo')); var_dump($instance->query('SELECT * FROM bar'));

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)
8.3.70.0070.00718.31
8.3.60.0130.00616.50
8.3.50.0160.00321.98
8.3.40.0120.00318.96
8.3.30.0070.00718.86
8.3.20.0040.00420.98
8.3.10.0040.00423.65
8.3.00.0030.00617.50
8.2.190.0030.01216.58
8.2.180.0030.01718.21
8.2.170.0120.00322.96
8.2.160.0040.01522.30
8.2.150.0090.00625.66
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0080.00019.77
8.2.110.0100.00019.30
8.2.100.0040.00717.91
8.2.90.0000.00818.03
8.2.80.0030.00619.66
8.2.70.0000.00817.93
8.2.60.0000.00818.04
8.2.50.0040.00418.10
8.2.40.0030.00620.55
8.2.30.0020.00519.28
8.2.20.0040.00418.27
8.2.10.0040.00418.12
8.2.00.0040.00417.71
8.1.280.0160.00325.92
8.1.270.0000.00823.92
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.01017.45
8.1.230.0040.00721.04
8.1.220.0050.00317.74
8.1.210.0060.00318.87
8.1.200.0030.00617.36
8.1.190.0030.00517.35
8.1.180.0080.00018.10
8.1.170.0050.00320.85
8.1.160.0040.00418.92
8.1.150.0020.00520.29
8.1.140.0050.00319.52
8.1.130.0000.00818.98
8.1.120.0040.00417.39
8.1.110.0030.00517.45
8.1.100.0000.00817.50
8.1.90.0040.00417.39
8.1.80.0000.00817.54
8.1.70.0040.00417.44
8.1.60.0030.00617.64
8.1.50.0030.00817.58
8.1.40.0070.00017.59
8.1.30.0000.00817.75
8.1.20.0000.00817.68
8.1.10.0040.00417.61
8.1.00.0030.00617.55
8.0.300.0040.00420.01
8.0.290.0060.00316.75
8.0.280.0070.00018.39
8.0.270.0030.00317.29
8.0.260.0050.00216.91
8.0.250.0070.00017.00
8.0.240.0000.00716.95
8.0.230.0000.00716.95
8.0.220.0000.00716.91
8.0.210.0050.00316.91
8.0.200.0030.00317.00
8.0.190.0080.00016.89
8.0.180.0000.00816.95
8.0.170.0080.00016.80
8.0.160.0000.00716.91
8.0.150.0030.00416.95
8.0.140.0000.00816.81
8.0.130.0000.00713.41
8.0.120.0040.00416.78
8.0.110.0040.00416.95
8.0.100.0040.00416.80
8.0.90.0070.00016.79
8.0.80.0090.00616.89
8.0.70.0000.00716.70
8.0.60.0080.00016.86
8.0.50.0040.00416.91
8.0.30.0130.00717.09
8.0.20.0100.00917.41
8.0.10.0000.00717.13
8.0.00.0140.00416.78
7.4.330.0050.00015.55
7.4.320.0030.00316.54
7.4.300.0040.00416.64
7.4.290.0000.00716.57
7.4.280.0040.00416.57
7.4.270.0000.00716.48
7.4.260.0000.00716.66
7.4.250.0070.00016.58
7.4.240.0040.00316.55
7.4.230.0000.00716.52
7.4.220.0040.01416.66
7.4.210.0070.00716.74
7.4.200.0000.00816.37
7.4.160.0070.00816.51
7.4.150.0090.00917.40
7.4.140.0050.01417.86
7.4.130.0080.01016.54
7.4.120.0120.00816.62
7.4.110.0110.00716.34
7.4.100.0120.01216.60
7.4.90.0120.01016.46
7.4.80.0120.00619.39
7.4.70.0070.01016.52
7.4.60.0060.01016.61
7.4.50.0110.00416.55
7.4.40.0090.00916.68
7.4.30.0090.00916.53
7.4.00.0040.01114.96
7.3.330.0030.00313.27
7.3.320.0000.00513.23
7.3.310.0030.00416.35
7.3.300.0070.00016.38
7.3.290.0090.00516.32
7.3.280.0090.00916.39
7.3.270.0090.00917.40
7.3.260.0160.00916.65
7.3.250.0120.00816.52
7.3.240.0090.00916.48
7.3.230.0070.01016.57
7.3.210.0090.00916.68
7.3.200.0080.01116.52
7.3.190.0110.01116.53
7.3.180.0070.01016.25
7.3.170.0110.00716.33
7.3.160.0070.01016.30
7.3.10.0130.00316.64
7.3.00.0040.00516.59
7.2.330.0030.02316.43
7.2.320.0030.01516.39
7.2.310.0060.01516.60
7.2.300.0060.01516.67
7.2.290.0100.00716.73
7.2.130.0060.00916.82
7.2.120.0030.01116.89
7.2.110.0050.00816.88
7.2.100.0040.00917.06
7.2.90.0030.01116.84
7.2.80.0030.00916.99
7.2.70.0080.00616.80
7.2.60.0090.00616.83
7.2.50.0030.01016.77
7.2.40.0050.00516.77
7.2.30.0030.01017.08
7.2.20.0040.00817.09
7.2.10.0050.01216.93
7.2.00.0070.00717.64
7.1.250.0090.00115.78
7.1.200.0060.00615.59
7.1.100.0040.00418.00
7.1.70.0080.00817.20
7.1.60.0040.01117.17
7.1.50.0040.00716.75
7.1.00.0100.06022.42
7.0.200.0040.00716.82
7.0.140.0000.08721.94
7.0.130.0130.05322.18
7.0.120.0130.06722.00
7.0.110.0030.06322.10
7.0.100.0070.06022.10
7.0.90.0100.07321.98
7.0.80.0100.07021.98
7.0.70.0100.06022.04
7.0.60.0100.05322.12
7.0.50.0100.05722.20
7.0.40.0070.05722.10
7.0.30.0100.05022.00
7.0.20.0030.08322.08
7.0.10.0100.05722.01
7.0.00.0030.05721.96
5.6.290.0030.06020.82
5.6.280.0100.05320.95
5.6.270.0100.05321.11
5.6.260.0030.06020.97
5.6.250.0030.06021.09
5.6.240.0130.05320.86
5.6.230.0030.07320.92
5.6.220.0030.05720.97
5.6.210.0030.05720.95
5.6.200.0070.05720.86
5.6.190.0070.06021.06
5.6.180.0070.05321.04
5.6.170.0070.05720.88
5.6.160.0100.05021.00
5.6.150.0000.06320.89
5.6.140.0070.05720.89
5.6.130.0030.06021.06
5.6.120.0070.06020.77
5.6.110.0130.07320.81
5.6.100.0030.06020.98
5.6.90.0070.06021.01
5.6.80.0100.04720.26
5.6.70.0100.06020.45
5.6.60.0070.08020.24
5.6.50.0170.05020.27
5.6.40.0100.07720.09
5.6.30.0130.06020.22
5.6.20.0030.08020.42
5.6.10.0070.05320.34
5.6.00.0100.07320.45

preferences:
18.49 ms | 401 KiB | 5 Q