3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Singleton { private static $instanciated = false; public function __construct() { if (self::$instanciated === true) { throw new RuntimeException('Could not instanciate class'); } self::$instanciated = true; } private $var; public function get(): int { return $this->var; } public function set(int $value) { $this->var = $value; } } class Factory { private $instance = null; public function getInstance() { echo "getInstance()\n"; if ($this->instance === null) { $this->instance = new Singleton(); } return $this->instance; } } $factory = new Factory(); $o = $factory->getInstance(); $o->set(5); $factory2 = new Factory(); $o2 = $factory->getInstance(); var_dump($o2->get());

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.40.0150.00018.79
8.3.30.0080.00818.67
8.3.20.0080.00020.36
8.3.10.0040.00423.65
8.3.00.0030.00519.38
8.2.170.0030.01022.96
8.2.160.0110.00320.53
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0060.00317.38
8.2.110.0050.00520.57
8.2.100.0090.00317.84
8.2.90.0050.00319.09
8.2.80.0060.00317.97
8.2.70.0090.00317.63
8.2.60.0040.00417.93
8.2.50.0000.00918.07
8.2.40.0020.00519.31
8.2.30.0050.00220.70
8.2.20.0040.00417.52
8.2.10.0060.00317.98
8.2.00.0040.00418.00
8.1.270.0080.00023.77
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0080.00323.77
8.1.230.0110.00022.82
8.1.220.0030.00517.74
8.1.210.0000.00818.77
8.1.200.0080.00017.23
8.1.190.0030.00716.88
8.1.180.0000.00918.10
8.1.170.0000.00718.96
8.1.160.0000.00721.95
8.1.150.0080.00418.82
8.1.140.0000.00819.44
8.1.130.0000.00717.55
8.1.120.0000.00717.34
8.1.110.0040.00317.29
8.1.100.0000.00717.43
8.1.90.0070.00017.42
8.1.80.0040.00417.23
8.1.70.0050.00217.43
8.1.60.0050.00317.48
8.1.50.0080.00017.48
8.1.40.0060.00317.48
8.1.30.0040.00417.63
8.1.20.0040.00417.64
8.1.10.0040.00417.57
8.1.00.0000.00717.53
8.0.300.0040.00418.77
8.0.290.0040.00416.63
8.0.280.0030.00318.44
8.0.270.0070.00017.20
8.0.260.0000.00617.21
8.0.250.0040.00416.76
8.0.240.0030.00516.90
8.0.230.0080.00016.95
8.0.220.0070.00016.86
8.0.210.0000.00816.73
8.0.200.0040.00416.95
8.0.190.0060.00316.77
8.0.180.0040.00416.84
8.0.170.0040.00416.86
8.0.160.0070.00016.75
8.0.150.0050.00316.81
8.0.140.0050.00316.81
8.0.130.0030.00313.29
8.0.120.0000.00716.84
8.0.110.0040.00416.86
8.0.100.0040.00416.80
8.0.90.0070.00016.73
8.0.80.0060.00916.71
8.0.70.0000.00716.73
8.0.60.0040.00416.83
8.0.50.0040.00416.90
8.0.30.0070.00817.01
8.0.20.0110.01117.40
8.0.10.0040.00416.92
8.0.00.0100.00916.70
7.4.330.0050.00015.08
7.4.320.0000.00616.62
7.4.300.0000.00716.62
7.4.290.0070.00016.53
7.4.280.0000.00816.45
7.4.270.0070.00016.58
7.4.260.0040.00416.52
7.4.250.0030.00516.47
7.4.240.0030.00416.43
7.4.230.0040.00416.32
7.4.220.0070.01016.64
7.4.210.0050.00816.55
7.4.200.0000.00816.35
7.4.160.0070.00716.22
7.4.150.0120.00617.40
7.4.140.0130.00717.86
7.4.130.0070.01116.72
7.4.120.0100.01116.61
7.4.110.0110.00816.74
7.4.100.0180.00516.59
7.4.90.0060.01216.48
7.4.80.0030.01419.39
7.4.70.0030.01416.50
7.4.60.0060.01016.56
7.4.50.0000.00516.54
7.4.40.0040.01416.46
7.4.30.0180.00316.47
7.4.00.0100.00515.00
7.3.330.0030.00313.23
7.3.320.0030.00313.14
7.3.310.0040.00416.21
7.3.300.0060.00016.27
7.3.290.0070.00016.31
7.3.280.0110.00716.25
7.3.270.0060.01317.40
7.3.260.0090.01216.38
7.3.240.0070.01016.48
7.3.230.0130.00316.53
7.3.210.0070.01016.53
7.3.200.0030.01316.38
7.3.190.0000.01616.39
7.3.180.0060.00916.52
7.3.170.0090.01216.57
7.3.160.0080.00816.37
7.3.120.0090.00914.85
7.3.110.0070.01115.02
7.3.100.0110.00714.87
7.3.90.0030.01414.71
7.3.80.0040.01214.95
7.3.70.0070.00714.71
7.3.60.0040.01114.71
7.3.50.0000.01314.78
7.3.40.0100.00314.81
7.3.30.0070.01114.46
7.3.20.0090.00616.68
7.3.10.0080.00816.60
7.3.00.0080.00316.82
7.2.330.0090.01216.82
7.2.320.0120.01216.83
7.2.310.0140.00316.80
7.2.300.0040.01216.64
7.2.290.0000.01916.87
7.2.250.0140.00415.05
7.2.240.0100.01014.88
7.2.230.0030.01014.86
7.2.220.0070.01015.29
7.2.210.0040.01115.02
7.2.200.0000.01015.34
7.2.190.0030.01014.81
7.2.180.0030.01014.83
7.2.170.0090.00615.05
7.2.60.0110.00416.97
7.2.00.0100.00719.34
7.1.330.0070.00715.69
7.1.320.0040.00815.92
7.1.310.0060.00915.50
7.1.300.0070.00715.91
7.1.290.0040.00815.63
7.1.280.0060.00315.78
7.1.270.0100.00615.95
7.1.260.0000.00915.66
7.1.200.0070.00415.85
7.1.100.0040.00818.14
7.1.70.0040.00416.84
7.1.60.0100.01319.43
7.1.50.0100.01016.64
7.1.00.0070.07322.37
7.0.200.0150.00414.62
7.0.60.0070.03720.05
7.0.50.0070.06317.89
7.0.40.0070.05020.37
7.0.30.0400.07320.19
7.0.20.0400.07320.15
7.0.10.0170.08020.12
7.0.00.0030.07320.14
5.6.280.0030.05021.12
5.6.210.0070.05320.54
5.6.200.0000.08018.19
5.6.190.0200.04320.39
5.6.180.0200.05720.50
5.6.170.0270.07720.56
5.6.160.0130.05720.51
5.6.150.0130.07318.16
5.6.140.0130.07718.18
5.6.130.0070.08318.19
5.6.120.0070.08020.97
5.6.110.0100.07321.13
5.6.100.0030.06020.98
5.6.90.0000.06721.11
5.6.80.0230.06020.29
5.5.350.0170.03720.53
5.5.340.0100.05318.09
5.5.330.0070.05320.47
5.5.320.0270.07720.36
5.5.310.0130.05020.50
5.5.300.0030.04018.01
5.5.290.0000.07017.97
5.5.280.0000.04320.77
5.5.270.0000.04320.87
5.5.260.0130.03020.65
5.5.250.0200.05020.62
5.5.240.0070.07720.24
5.4.450.0170.06019.07
5.4.440.0800.05719.09
5.4.430.0730.07019.05
5.4.420.0870.08019.57
5.4.410.1000.07019.18
5.4.400.0830.05019.13
5.4.390.0830.08319.19
5.4.380.0770.05318.94
5.4.370.1000.06019.02
5.4.360.0930.07318.99
5.4.350.1030.05319.13
5.4.340.0700.05719.16
5.4.320.0830.05718.99
5.4.310.0270.05719.16
5.4.300.0330.05719.17
5.4.290.0330.06319.00
5.4.280.0270.07018.98
5.4.270.0470.07319.12
5.4.260.0200.07018.76
5.4.250.0270.05319.29
5.4.240.0400.05718.84
5.4.230.0430.05319.00
5.4.220.0430.07319.11
5.4.210.0300.06719.12
5.4.200.0370.05319.16
5.4.190.0230.06719.14
5.4.180.0330.05019.16
5.4.170.0130.06019.14
5.4.160.0300.06018.96
5.4.150.0200.05718.99
5.4.140.0170.05716.29
5.4.130.0270.04316.37
5.4.120.0170.05716.58
5.4.110.0300.04316.62
5.4.100.0270.04716.57
5.4.90.0170.05716.59
5.4.80.1270.06316.43
5.4.70.0130.05716.57
5.4.60.0170.06016.22
5.4.50.0200.04716.22
5.4.40.0100.06016.58
5.4.30.0270.05016.21
5.4.20.0230.05316.21
5.4.10.0330.06316.53
5.4.00.0270.04315.86

preferences:
43.03 ms | 400 KiB | 5 Q