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; echo "new instance\n"; } 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() { 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.60.0000.01418.55
8.3.50.0220.00921.98
8.3.40.0100.01018.76
8.3.30.0070.00718.69
8.3.20.0050.00320.15
8.3.10.0050.00321.96
8.3.00.0040.00419.50
8.2.180.0140.00718.29
8.2.170.0140.00022.96
8.2.160.0140.00020.35
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0040.00417.50
8.2.110.0030.00620.92
8.2.100.0000.01218.04
8.2.90.0000.00819.20
8.2.80.0000.00817.97
8.2.70.0060.00317.62
8.2.60.0050.00318.05
8.2.50.0060.00318.07
8.2.40.0060.00319.38
8.2.30.0000.00720.59
8.2.20.0020.00517.53
8.2.10.0000.00817.91
8.2.00.0040.00418.07
8.1.280.0210.00025.92
8.1.270.0060.00323.75
8.1.260.0080.00026.35
8.1.250.0000.00828.09
8.1.240.0090.00019.43
8.1.230.0040.00817.54
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0030.00617.23
8.1.190.0040.00417.35
8.1.180.0000.00818.10
8.1.170.0040.00418.91
8.1.160.0000.00721.96
8.1.150.0030.00618.75
8.1.140.0040.00419.49
8.1.130.0070.00017.66
8.1.120.0070.00017.33
8.1.110.0000.00717.23
8.1.100.0030.00517.30
8.1.90.0020.00517.40
8.1.80.0040.00417.42
8.1.70.0000.00617.38
8.1.60.0040.00417.45
8.1.50.0000.00817.51
8.1.40.0000.00817.54
8.1.30.0050.00317.55
8.1.20.0000.00817.49
8.1.10.0040.00417.55
8.1.00.0070.00017.50
8.0.300.0000.00718.77
8.0.290.0070.00016.75
8.0.280.0070.00018.46
8.0.270.0030.00317.18
8.0.260.0000.00717.14
8.0.250.0040.00416.84
8.0.240.0050.00316.90
8.0.230.0060.00316.82
8.0.220.0040.00416.72
8.0.210.0000.00816.84
8.0.200.0000.00616.89
8.0.190.0080.00316.80
8.0.180.0000.00716.92
8.0.170.0000.00716.86
8.0.160.0050.00316.75
8.0.150.0040.00416.80
8.0.140.0040.00416.69
8.0.130.0000.00513.33
8.0.120.0030.00616.71
8.0.110.0040.00416.85
8.0.100.0000.00716.79
8.0.90.0050.00216.62
8.0.80.0130.00316.83
8.0.70.0040.00416.84
8.0.60.0070.00016.90
8.0.50.0000.00716.84
8.0.30.0050.01017.06
8.0.20.0120.00517.40
8.0.10.0040.00416.83
8.0.00.0120.01116.73
7.4.330.0060.00015.08
7.4.320.0000.00716.61
7.4.300.0000.00716.50
7.4.290.0050.00216.64
7.4.280.0030.00516.62
7.4.270.0000.00716.47
7.4.260.0080.00016.55
7.4.250.0000.00716.56
7.4.240.0020.00616.52
7.4.230.0000.00716.51
7.4.220.0040.01216.55
7.4.210.0050.01016.61
7.4.200.0000.00716.40
7.4.160.0120.00316.39
7.4.150.0060.01217.40
7.4.140.0120.01217.86
7.4.130.0140.00916.53
7.4.120.0110.01216.54
7.4.110.0120.00916.55
7.4.100.0060.01216.43
7.4.90.0130.01016.56
7.4.80.0080.00819.39
7.4.70.0100.00716.51
7.4.60.0100.00616.50
7.4.50.0030.00316.66
7.4.40.0110.00616.56
7.4.30.0170.03316.61
7.4.00.0100.00714.66
7.3.330.0060.00013.09
7.3.320.0060.00013.14
7.3.310.0000.00716.22
7.3.300.0070.00016.32
7.3.290.0070.00016.30
7.3.280.0050.01216.31
7.3.270.0120.00617.40
7.3.260.0030.01316.57
7.3.240.0070.01016.49
7.3.230.0060.00916.39
7.3.210.0110.00816.38
7.3.200.0060.01016.39
7.3.190.0030.01316.44
7.3.180.0060.01016.27
7.3.170.0060.01016.41
7.3.160.0100.00716.31
7.3.00.0040.00816.29
7.2.330.0000.01716.83
7.2.320.0150.00916.66
7.2.310.0140.00416.79
7.2.300.0100.00716.54
7.2.290.0100.01316.56
7.2.130.0030.00916.67
7.2.120.0060.00616.77
7.2.110.0000.01316.64
7.2.100.0060.00616.99
7.2.90.0030.00717.01
7.2.80.0040.01116.99
7.2.70.0040.00716.84
7.2.60.0020.01216.96
7.2.50.0030.01017.08
7.2.40.0030.01216.98
7.2.30.0060.00916.98
7.2.20.0060.00616.89
7.2.10.0100.00616.70
7.2.00.0020.01018.01
7.1.250.0060.00615.66
7.1.240.0090.00615.59
7.1.230.0040.00715.69
7.1.220.0000.01615.50
7.1.210.0000.01315.86
7.1.200.0040.00715.73
7.1.190.0030.01015.84
7.1.180.0080.00015.45
7.1.170.0030.01015.86
7.1.160.0040.01115.71
7.1.150.0000.01415.38
7.1.140.0110.00315.63
7.1.130.0000.01215.66
7.1.120.0040.00815.55
7.1.110.0080.00415.58
7.1.100.0080.00317.11
7.1.90.0030.01015.68
7.1.80.0030.00715.90
7.1.70.0070.00616.59
7.1.60.0060.01117.54
7.1.50.0020.01016.47
7.1.40.0070.01015.49
7.1.30.0030.00715.81
7.1.20.0030.00915.70
7.1.10.0080.00415.57
7.1.00.0060.04119.12
7.0.330.0070.00315.41
7.0.320.0100.00315.33
7.0.310.0030.01015.32
7.0.300.0100.00015.40
7.0.290.0040.00715.29
7.0.280.0040.01115.41
7.0.270.0030.00615.43
7.0.260.0030.01015.30
7.0.250.0070.00315.28
7.0.240.0100.00315.20
7.0.230.0000.01415.59
7.0.220.0080.00015.51
7.0.210.0030.01015.34
7.0.200.0140.00915.06
7.0.190.0040.00415.48
7.0.180.0060.00615.29
7.0.170.0060.00915.45
7.0.160.0040.00715.33
7.0.150.0030.00915.36
7.0.140.0000.01015.48
7.0.130.0090.00615.44
7.0.120.0000.01315.21
7.0.110.0030.00715.18
7.0.100.0090.00615.28
7.0.90.0030.00915.40
7.0.80.0000.00715.53
7.0.70.0000.01415.46
7.0.60.0060.02017.67
7.0.50.0070.03816.77
7.0.40.0070.04516.79
7.0.30.0230.04016.79
7.0.20.0150.02816.81
7.0.10.0070.03216.83
7.0.00.0080.03516.92
5.6.380.0040.01114.22
5.6.370.0030.01014.41
5.6.360.0000.01214.40
5.6.350.0040.00814.24
5.6.340.0030.00613.97
5.6.330.0060.00614.05
5.6.320.0100.00014.32
5.6.310.0100.00313.88
5.6.300.0090.00913.91
5.6.290.0000.01213.97
5.6.280.0070.02917.46
5.6.270.0000.00914.09
5.6.260.0060.00313.96
5.6.250.0060.00613.79
5.6.240.0060.00313.90
5.6.230.0060.00614.21
5.6.220.0080.00414.40
5.6.210.0070.02017.39
5.6.200.0110.04116.17
5.6.190.0030.04617.43
5.6.180.0250.02417.28
5.6.170.0170.03817.30
5.6.160.0020.05017.24
5.6.150.0020.03816.13
5.6.140.0050.02316.31
5.6.130.0070.04416.09
5.6.120.0050.04917.61
5.6.110.0120.03517.54
5.6.100.0080.04117.54
5.6.90.0120.03017.60
5.6.80.0070.03517.22
5.6.70.0040.00813.95
5.6.60.0000.01413.92
5.6.50.0040.00414.14
5.6.40.0100.00313.93
5.6.30.0000.01313.64
5.6.20.0090.00314.09
5.6.10.0130.00314.17
5.6.00.0100.00314.10
5.5.380.0030.00911.18
5.5.370.0030.00611.18
5.5.360.0030.00711.18
5.5.350.0120.01815.78
5.5.340.0080.03614.58
5.5.330.0070.04215.77
5.5.320.0180.03815.74
5.5.310.0140.02015.74
5.5.300.0030.02014.57
5.5.290.0050.04814.61
5.5.280.0070.02315.97
5.5.270.0030.02315.90
5.5.260.0030.02416.04
5.5.250.0080.04415.94
5.5.240.0030.04415.76
5.5.230.0030.00311.18
5.5.220.0080.00311.18
5.5.210.0060.00611.18
5.5.200.0030.00711.18
5.5.190.0040.00811.18
5.5.180.0030.00911.18
5.5.170.0060.00311.18
5.5.160.0070.00711.18
5.5.150.0080.00411.18
5.5.140.0040.00711.18
5.5.130.0070.00711.18
5.5.120.0060.00311.18
5.5.110.0070.00411.18
5.5.100.0040.00711.18
5.5.90.0030.00711.18
5.5.80.0000.01011.18
5.5.70.0040.00411.18
5.5.60.0040.00711.18
5.5.50.0070.00411.18
5.5.40.0000.00511.18
5.5.30.0030.00611.18
5.5.20.0000.01111.18
5.5.10.0060.00611.18
5.5.00.0040.00711.18
5.4.450.0100.03715.34
5.4.440.0100.03715.29
5.4.430.0170.02515.26
5.4.420.0070.03515.36
5.4.410.0120.03215.35
5.4.400.0150.03015.25
5.4.390.0070.03415.11
5.4.380.0130.03215.20
5.4.370.0100.02815.18
5.4.360.0100.02915.20
5.4.350.0120.02815.12
5.4.340.0020.03815.09
5.4.330.0040.00411.18
5.4.320.0110.02515.25
5.4.310.0200.02815.19
5.4.300.0320.03014.98
5.4.290.0400.02115.15
5.4.280.0170.02515.07
5.4.270.0080.03315.18
5.4.260.0060.03315.19
5.4.250.0080.03615.12
5.4.240.0060.03015.18
5.4.230.0100.03115.13
5.4.220.0150.03015.11
5.4.210.0050.03315.20
5.4.200.0130.02615.20
5.4.190.0470.02715.10
5.4.180.0430.02515.18
5.4.170.0430.02815.04
5.4.160.0420.02715.20
5.4.150.0420.04015.08
5.4.140.0400.02513.78
5.4.130.0510.03313.79
5.4.120.0400.03213.76
5.4.110.0380.03213.75
5.4.100.0480.03513.87
5.4.90.0400.02813.87
5.4.80.0190.02513.84
5.4.70.0100.02813.79
5.4.60.0110.02913.88
5.4.50.0080.03413.71
5.4.40.0100.02813.86
5.4.30.0160.02313.66
5.4.20.0180.02813.85
5.4.10.0080.03213.86
5.4.00.0130.02913.58

preferences:
53.84 ms | 401 KiB | 5 Q