3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Factory { private $instance = null; public function getInstance() { if ($this->instance === null) { $this->instance = new class() { private static $instanciated = false; public function __construct() { if (self::$instanciated) { 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; } }; } 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.60.0040.01116.75
8.3.50.0070.01018.18
8.3.40.0040.01118.79
8.3.30.0040.01118.88
8.3.20.0040.00420.16
8.3.10.0050.00323.69
8.3.00.0060.00319.38
8.2.180.0080.00818.41
8.2.170.0120.00322.96
8.2.160.0100.00320.21
8.2.150.0000.00824.18
8.2.140.0000.00724.66
8.2.130.0050.00326.16
8.2.120.0040.00717.63
8.2.110.0060.00622.12
8.2.100.0100.00017.93
8.2.90.0040.00419.04
8.2.80.0080.00017.97
8.2.70.0080.00017.75
8.2.60.0040.00417.92
8.2.50.0060.00318.07
8.2.40.0000.00719.34
8.2.30.0040.00420.75
8.2.20.0000.00817.60
8.2.10.0030.00518.18
8.2.00.0070.00018.13
8.1.280.0070.01125.92
8.1.270.0060.00323.93
8.1.260.0000.00826.35
8.1.250.0080.00028.09
8.1.240.0090.00022.61
8.1.230.0040.00817.66
8.1.220.0000.00917.75
8.1.210.0040.00418.77
8.1.200.0030.00617.35
8.1.190.0060.00317.23
8.1.180.0060.00318.10
8.1.170.0000.00718.79
8.1.160.0040.00421.99
8.1.150.0100.00018.90
8.1.140.0000.00719.58
8.1.130.0000.00717.76
8.1.120.0040.00417.48
8.1.110.0000.00717.49
8.1.100.0040.00417.49
8.1.90.0040.00417.46
8.1.80.0040.00717.35
8.1.70.0070.00017.36
8.1.60.0000.00917.61
8.1.50.0030.00517.55
8.1.40.0000.00817.60
8.1.30.0030.00517.69
8.1.20.0040.00417.58
8.1.10.0070.00017.51
8.1.00.0040.00417.59
8.0.300.0050.00318.77
8.0.290.0040.00416.63
8.0.280.0080.00018.46
8.0.270.0000.00717.32
8.0.260.0040.00417.27
8.0.250.0000.00716.85
8.0.240.0080.00016.98
8.0.230.0090.00017.03
8.0.220.0000.00716.80
8.0.210.0030.00516.93
8.0.200.0030.00316.99
8.0.190.0070.00016.86
8.0.180.0000.00716.81
8.0.170.0040.00416.84
8.0.160.0040.00416.80
8.0.150.0030.00316.89
8.0.140.0000.00816.86
8.0.130.0000.00613.38
8.0.120.0000.00716.91
8.0.110.0000.00716.95
8.0.100.0000.00816.82
8.0.90.0000.00716.70
8.0.80.0060.00916.88
8.0.70.0050.00316.73
8.0.60.0000.00716.84
8.0.50.0000.00716.78
8.0.30.0050.01417.04
8.0.20.0120.00617.40
8.0.10.0000.00716.97
8.0.00.0080.01116.76
7.4.330.0000.00515.08
7.4.320.0000.00616.64
7.4.300.0030.00316.57
7.4.290.0030.00316.62
7.4.280.0050.00216.51
7.4.270.0040.00416.61
7.4.260.0000.00716.57
7.4.250.0040.00416.41
7.4.240.0030.00416.51
7.4.230.0000.00716.64
7.4.220.0160.00316.71
7.4.210.0080.00816.64
7.4.200.0040.00416.59
7.4.160.0110.00516.38
7.4.150.0150.00317.40
7.4.140.0160.00717.86
7.4.130.0130.00816.65
7.4.120.0050.01316.62
7.4.110.0130.00616.57
7.4.100.0060.01216.52
7.4.90.0140.00416.39
7.4.80.0030.01319.39
7.4.70.0060.01016.29
7.4.60.0090.00816.52
7.4.50.0000.00516.55
7.4.40.0070.01016.66
7.4.30.0100.00716.41
7.4.00.0000.01615.07
7.3.330.0030.00313.15
7.3.320.0000.00513.18
7.3.310.0030.00316.35
7.3.300.0070.00016.28
7.3.290.0030.00516.18
7.3.280.0070.01116.29
7.3.270.0070.01117.40
7.3.260.0080.01116.49
7.3.240.0050.01216.38
7.3.230.0100.00716.39
7.3.210.0120.00416.48
7.3.200.0140.00316.27
7.3.190.0120.00916.59
7.3.180.0090.00916.30
7.3.170.0030.01516.31
7.3.160.0070.01016.54
7.3.10.0050.01116.54
7.3.00.0060.00816.66
7.2.330.0100.00716.54
7.2.320.0100.01016.84
7.2.310.0070.01416.69
7.2.300.0090.00916.82
7.2.290.0150.00416.90
7.2.130.0070.00916.89
7.2.120.0130.00216.76
7.2.110.0080.00716.68
7.2.100.0080.00816.81
7.2.90.0080.00616.84
7.2.80.0020.01516.92
7.2.70.0070.00916.88
7.2.60.0070.00916.96
7.2.50.0070.00916.87
7.2.40.0140.00516.93
7.2.30.0050.00917.04
7.2.20.0030.01216.72
7.2.10.0120.00616.82
7.2.00.0090.00417.61
7.1.250.0050.01015.72
7.1.240.0070.01015.04
7.1.230.0140.00015.57
7.1.220.0060.00915.74
7.1.210.0040.01215.53
7.1.200.0110.00515.72
7.1.190.0070.01515.66
7.1.180.0040.00715.64
7.1.170.0150.00415.56
7.1.160.0100.00615.32
7.1.150.0070.00715.72
7.1.140.0070.01015.80
7.1.130.0090.00615.75
7.1.120.0100.00615.55
7.1.110.0100.00315.82
7.1.100.0080.00517.09
7.1.90.0000.01315.55
7.1.80.0030.01415.70
7.1.70.0060.00616.25
7.1.60.0110.01117.63
7.1.50.0070.01016.18
7.1.40.0070.00715.27
7.1.30.0070.01015.54
7.1.20.0060.00915.34
7.1.10.0130.00615.65
7.1.00.0070.04219.27
7.0.330.0100.00615.18
7.0.320.0150.00615.07
7.0.310.0160.00515.52
7.0.300.0160.00615.41
7.0.290.0130.00615.20
7.0.280.0100.01015.07
7.0.270.0070.00715.38
7.0.260.0140.00415.01
7.0.250.0090.00515.29
7.0.240.0090.00615.32
7.0.230.0030.01415.43
7.0.220.0090.00915.22
7.0.210.0110.00415.45
7.0.200.0870.01014.92
7.0.190.0110.00515.06
7.0.180.0120.00315.05
7.0.170.0080.01115.27
7.0.160.0130.00615.24
7.0.150.0100.01115.07
7.0.140.0180.00715.55
7.0.130.0230.00815.44
7.0.120.0220.00715.49
7.0.110.0130.01315.11
7.0.100.0070.02215.43
7.0.90.0170.00215.23
7.0.80.0230.00415.16
7.0.70.0180.00915.30
7.0.60.0110.02617.73
7.0.50.0130.04216.75
7.0.40.0080.03016.68
7.0.30.0310.03416.71
7.0.20.0190.03416.58
7.0.10.0070.03216.73
7.0.00.0020.03716.61
5.6.380.0080.00613.82
5.6.370.0030.00913.64
5.6.360.0070.00713.52
5.6.350.0030.01014.09
5.6.340.0080.00613.96
5.6.330.0030.01013.54
5.6.320.0030.01013.98
5.6.310.0090.00013.89
5.6.300.0100.00314.13
5.6.290.0070.00613.97
5.6.280.0070.04117.47
5.6.270.0170.00313.96
5.6.260.0120.00413.97
5.6.250.0070.01014.19
5.6.240.0030.01313.91
5.6.230.0080.00814.15
5.6.220.0000.01513.85
5.6.210.0020.03117.24
5.6.200.0060.03516.09
5.6.190.0030.03417.32
5.6.180.0250.03017.25
5.6.170.0190.02817.23
5.6.160.0100.02217.20
5.6.150.0090.03416.07
5.6.140.0080.04416.07
5.6.130.0090.03116.12
5.6.120.0100.04217.38
5.6.110.0140.03717.42
5.6.100.0030.03617.41
5.6.90.0060.04817.55
5.6.80.0050.04017.17
5.6.70.0060.00614.08
5.6.60.0080.00813.84
5.6.50.0030.01113.76
5.6.40.0140.00313.80
5.6.30.0040.01513.76
5.6.20.0000.01414.08
5.6.10.0060.00613.92
5.6.00.0040.01113.98
5.5.380.0090.00310.64
5.5.370.0030.00910.68
5.5.360.0040.00811.12
5.5.350.0140.02115.55
5.5.340.0060.04114.36
5.5.330.0050.04515.54
5.5.320.0160.02215.52
5.5.310.0180.04215.29
5.5.300.0050.03114.26
5.5.290.0080.03514.53
5.5.280.0070.02015.82
5.5.270.0050.02015.65
5.5.260.0010.02815.86
5.5.250.0070.03515.67
5.5.240.0040.04115.51
5.5.230.0030.00510.80
5.5.220.0000.01210.64
5.5.210.0070.00310.83
5.5.200.0040.00410.71
5.5.190.0030.00910.40
5.5.180.0090.00010.90
5.5.170.0040.00810.61
5.5.160.0000.01310.78
5.5.150.0000.00710.63
5.5.140.0030.00510.76
5.5.130.0000.00710.62
5.5.120.0060.00610.68
5.5.110.0060.00610.65
5.5.100.0060.00510.36
5.5.90.0070.00310.48
5.5.80.0090.00310.72
5.5.70.0030.00810.68
5.5.60.0060.00610.68
5.5.50.0060.00610.69
5.5.40.0030.00910.59
5.5.30.0040.00710.73
5.5.20.0000.00610.50
5.5.10.0050.00510.56
5.5.00.0030.00310.59
5.4.450.0090.03014.88
5.4.440.0130.02714.93
5.4.430.0100.03314.66
5.4.420.0090.03214.87
5.4.410.0100.02815.07
5.4.400.0160.02514.94
5.4.390.0140.02614.69
5.4.380.0130.02614.98
5.4.370.0120.02814.92
5.4.360.0070.03214.52
5.4.350.0080.03014.78
5.4.340.0100.03014.83
5.4.330.0000.00510.69
5.4.320.0130.02614.85
5.4.310.0120.02814.93
5.4.300.0140.02314.86
5.4.290.0070.04014.81
5.4.280.0080.04214.87
5.4.270.0060.03614.77
5.4.260.0090.02914.81
5.4.250.0080.03014.91
5.4.240.0100.02914.91
5.4.230.0050.03414.82
5.4.220.0100.02714.60
5.4.210.0080.03114.94
5.4.200.0150.03114.75
5.4.190.0130.04014.71
5.4.180.0100.03414.80
5.4.170.0110.02814.79
5.4.160.0100.02814.85
5.4.150.0100.03014.76
5.4.140.0180.02813.22
5.4.130.0130.02713.33
5.4.120.0100.03913.28
5.4.110.0110.04113.38
5.4.100.0160.03313.50
5.4.90.0050.04213.55
5.4.80.0180.03213.58
5.4.70.0030.03413.53
5.4.60.0120.02913.59
5.4.50.0130.02813.55
5.4.40.0170.02213.61
5.4.30.0080.02513.42
5.4.20.0300.02713.69
5.4.10.0150.02513.42
5.4.00.0090.02613.29

preferences:
62.02 ms | 400 KiB | 5 Q