3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Musket { private static $instanciated = false; private $var; public function __construct() { if (self::$instanciated === true) { throw new RuntimeException('Could not instanciate class'); } self::$instanciated = true; } // Interdiction du clonage private function __clone() { } 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 Musket(); } return $this->instance; } } $factory = new Factory(); $o = $factory->getInstance(); $o->set(5); $factory2 = new Factory(); // Génère une exception "Could not instanciate class" $o2 = $factory2->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)
8.3.60.0030.01416.62
8.3.50.0110.00821.99
8.3.40.0140.00018.78
8.3.30.0110.00418.92
8.3.20.0070.00020.20
8.3.10.0040.00421.77
8.3.00.0080.00019.50
8.2.180.0090.00916.88
8.2.170.0040.01122.96
8.2.160.0070.00722.25
8.2.150.0050.00224.18
8.2.140.0000.00724.66
8.2.130.0030.00617.75
8.2.120.0040.00426.35
8.2.110.0030.00622.08
8.2.100.0040.00817.80
8.2.90.0000.00819.23
8.2.80.0100.00017.97
8.2.70.0040.00417.50
8.2.60.0060.00317.88
8.2.50.0030.00618.07
8.2.40.0060.00319.29
8.2.30.0000.00820.67
8.2.20.0030.00717.62
8.2.10.0000.00718.07
8.2.00.0040.00418.07
8.1.280.0060.01225.92
8.1.270.0080.00023.80
8.1.260.0000.00728.09
8.1.250.0050.00328.09
8.1.240.0030.00622.55
8.1.230.0110.00017.66
8.1.220.0040.00417.78
8.1.210.0000.00818.77
8.1.200.0040.00417.35
8.1.190.0000.00917.23
8.1.180.0020.00518.10
8.1.170.0070.00020.10
8.1.160.0060.00321.95
8.1.150.0040.00418.88
8.1.140.0000.00919.64
8.1.130.0030.00317.79
8.1.120.0000.00717.46
8.1.110.0040.00417.50
8.1.100.0070.00017.46
8.1.90.0000.00717.51
8.1.80.0030.00617.39
8.1.70.0070.00017.46
8.1.60.0050.00317.64
8.1.50.0050.00317.57
8.1.40.0070.00517.54
8.1.30.0080.00017.72
8.1.20.0000.00817.56
8.1.10.0040.00417.56
8.1.00.0040.00417.53
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0000.00718.50
8.0.270.0000.00717.28
8.0.260.0030.00317.14
8.0.250.0000.00717.04
8.0.240.0080.00016.85
8.0.230.0030.00317.04
8.0.220.0070.00016.78
8.0.210.0020.00516.95
8.0.200.0070.00016.96
8.0.190.0000.00717.04
8.0.180.0040.00416.99
8.0.170.0050.00316.96
8.0.160.0030.00516.91
8.0.150.0050.00216.87
8.0.140.0030.00516.87
8.0.130.0030.00313.43
8.0.120.0030.00516.98
8.0.110.0040.00416.84
8.0.100.0040.00416.97
8.0.90.0070.00016.98
8.0.80.0060.00916.95
8.0.70.0000.00716.99
8.0.60.0040.00417.00
8.0.50.0000.00816.93
8.0.30.0050.01217.04
8.0.20.0070.01317.40
8.0.10.0040.00417.11
8.0.00.0120.00516.80
7.4.330.0020.00216.71
7.4.320.0000.00616.42
7.4.300.0030.00316.38
7.4.290.0030.00616.64
7.4.280.0030.00616.60
7.4.270.0060.00016.51
7.4.260.0040.00416.52
7.4.250.0000.00816.63
7.4.240.0060.00216.55
7.4.230.0030.00316.70
7.4.220.0100.01316.57
7.4.210.0060.01016.61
7.4.200.0030.00316.41
7.4.160.0090.00616.60
7.4.150.0100.00717.40
7.4.140.0120.00717.86
7.4.130.0100.00716.65
7.4.120.0100.00816.58
7.4.110.0160.00316.67
7.4.100.0130.01016.49
7.4.90.0100.00716.67
7.4.80.0090.01519.39
7.4.70.0090.01516.75
7.4.60.0060.01016.52
7.4.50.0070.01116.65
7.4.40.0130.00616.48
7.4.30.0130.01016.30
7.4.10.0100.00315.22
7.4.00.0050.01215.10
7.3.330.0000.00613.33
7.3.320.0030.00313.24
7.3.310.0040.00416.23
7.3.300.0070.00016.36
7.3.290.0000.00716.38
7.3.280.0110.01116.36
7.3.270.0100.00717.40
7.3.260.0060.01216.45
7.3.250.0130.00516.42
7.3.240.0090.00916.32
7.3.230.0080.00816.50
7.3.210.0100.00616.46
7.3.200.0160.00016.73
7.3.190.0110.00516.41
7.3.180.0100.00716.45
7.3.170.0060.01016.54
7.3.160.0070.00716.45
7.3.130.0070.01114.91
7.3.120.0030.01614.88
7.3.110.0030.01314.85
7.3.100.0040.01114.94
7.3.90.0070.00714.71
7.3.80.0070.00714.96
7.3.70.0040.00814.94
7.3.60.0030.01215.04
7.3.50.0060.00614.91
7.3.40.0090.00314.69
7.3.30.0040.00414.84
7.3.20.0000.00916.60
7.3.10.0040.01116.70
7.3.00.0100.00316.48
7.2.330.0150.00416.36
7.2.320.0090.00916.70
7.2.310.0130.00316.80
7.2.300.0000.02116.45
7.2.290.0080.01116.61
7.2.260.0030.01714.80
7.2.250.0040.01514.93
7.2.240.0040.01215.18
7.2.230.0070.01115.26
7.2.220.0060.00615.13
7.2.210.0060.00314.89
7.2.200.0030.00914.91
7.2.190.0120.00214.95
7.2.180.0060.00915.20
7.2.170.0080.00615.06
7.2.160.0030.01015.09
7.2.150.0030.01017.03
7.2.140.0090.00616.96
7.2.130.0090.00616.93
7.2.120.0000.01417.04
7.2.110.0000.01216.99
7.2.100.0030.00916.71
7.2.90.0070.00317.03
7.2.80.0090.00917.09
7.2.70.0060.00617.01
7.2.60.0000.01217.00
7.2.50.0090.00616.73
7.2.40.0030.01816.85
7.2.30.0120.00317.05
7.2.20.0080.00816.97
7.2.10.0030.01316.91
7.2.00.0100.00718.18
7.1.330.0030.01015.93
7.1.320.0060.00915.85
7.1.310.0060.00615.63
7.1.300.0070.00715.79
7.1.290.0070.00315.75
7.1.280.0080.00815.97
7.1.270.0060.00615.82
7.1.260.0080.00415.79
7.1.250.0060.00915.81
7.1.240.0100.00315.94
7.1.230.0070.01015.73
7.1.220.0120.00315.48
7.1.210.0030.01015.50
7.1.200.0050.01015.62
7.1.190.0100.00315.82
7.1.180.0030.00915.75
7.1.170.0000.01115.91
7.1.160.0130.00715.66
7.1.150.0030.00715.63
7.1.140.0060.01215.71
7.1.130.0030.01015.68
7.1.120.0030.00915.96
7.1.110.0000.01715.76
7.1.100.0050.01117.05
7.1.90.0040.01115.75
7.1.80.0040.01215.86
7.1.70.0000.01016.18
7.1.60.0130.00817.56
7.1.50.0030.01016.25
7.1.40.0050.00515.51
7.1.30.0000.01515.73
7.1.20.0060.00915.77
7.1.10.0000.01015.82
7.1.00.0080.03718.90
7.0.330.0030.00615.45
7.0.320.0070.00715.39
7.0.310.0100.00315.25
7.0.300.0070.00715.33
7.0.290.0000.00915.46
7.0.280.0120.00315.51
7.0.270.0040.01115.36
7.0.260.0080.00815.18
7.0.250.0030.01015.61
7.0.240.0000.01315.42
7.0.230.0000.01115.52
7.0.220.0070.00415.27
7.0.210.0100.00715.30
7.0.200.0170.00715.04
7.0.190.0030.00615.29
7.0.180.0030.01315.65
7.0.170.0040.01115.41
7.0.160.0060.00615.52
7.0.150.0050.00515.26
7.0.140.0040.00715.60
7.0.130.0060.00915.61
7.0.120.0040.00415.50
7.0.110.0030.00615.22
7.0.100.0000.01215.46
7.0.90.0040.00415.49
7.0.80.0060.00615.39
7.0.70.0000.01415.45
7.0.60.0130.02517.72
7.0.50.0020.03216.58
7.0.40.0070.04716.74
7.0.30.0070.03316.82
7.0.20.0180.02816.88
7.0.10.0080.03816.71
7.0.00.0050.02816.82
5.6.400.0080.00414.07
5.6.390.0030.00913.70
5.6.380.0100.00714.10
5.6.370.0070.00713.75
5.6.360.0000.01413.84
5.6.350.0030.00614.10
5.6.340.0000.01514.28
5.6.330.0150.00413.89
5.6.320.0040.01114.20
5.6.310.0130.00014.22
5.6.300.0040.01214.11
5.6.290.0060.00914.53
5.6.280.0080.03317.45
5.6.270.0130.00014.11
5.6.260.0060.00914.29
5.6.250.0130.00014.18
5.6.240.0100.00314.22
5.6.230.0000.01513.98
5.6.220.0030.00714.02
5.6.210.0070.04317.42
5.6.200.0070.02116.14
5.6.190.0070.04617.26
5.6.180.0130.04817.52
5.6.170.0190.03317.36
5.6.160.0100.02617.19
5.6.150.0020.02516.05
5.6.140.0070.04516.32
5.6.130.0100.04116.14
5.6.120.0080.02317.63
5.6.110.0060.03617.59
5.6.100.0150.03917.47
5.6.90.0100.03317.55
5.6.80.0060.02817.27
5.6.70.0030.01014.17
5.6.60.0090.00614.27
5.6.50.0080.00814.12
5.6.40.0040.00414.14
5.6.30.0060.00614.16
5.6.20.0070.00313.82
5.6.10.0040.00714.02
5.6.00.0080.00414.05
5.5.380.0080.00814.27
5.5.370.0110.00314.00
5.5.360.0030.01013.89
5.5.350.0200.03317.50
5.5.340.0090.04215.93
5.5.330.0070.02717.03
5.5.320.0190.03917.21
5.5.310.0240.02417.08
5.5.300.0020.03716.16
5.5.290.0070.02715.97
5.5.280.0090.02517.61
5.5.270.0060.04517.44
5.5.260.0050.04617.27
5.5.250.0030.03317.37
5.5.240.0110.02317.19
5.5.230.0060.00614.05
5.5.220.0070.00713.90
5.5.210.0090.00614.17
5.5.200.0070.00314.12
5.5.190.0050.00514.14
5.5.180.0100.00313.82
5.5.170.0000.01214.10
5.5.160.0000.00813.91
5.5.150.0020.00614.06
5.5.140.0050.00513.71
5.5.130.0080.00013.64
5.5.120.0060.00614.16
5.5.110.0080.00014.11
5.5.100.0030.00614.12
5.5.90.0140.00013.83
5.5.80.0060.01313.60
5.5.70.0030.01513.67
5.5.60.0060.01213.80
5.5.50.0150.00013.79
5.5.40.0060.01214.02
5.5.30.0000.01013.85
5.5.20.0000.01114.13
5.5.10.0080.00413.85
5.5.00.0030.01013.99

preferences:
54.93 ms | 401 KiB | 5 Q