3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { protected function ts() { return 3; } public function testclosure() { return function() { return $this->ts(); }; } public function testclosure2() { $this2 = $this; return function() use ($this2) { return $this2->ts(); }; } } $t = new Test; $f1 = $t->testclosure(); echo($f1()."\n"); $f2 = $t->testclosure2(); echo($f1()."\n");

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.4.20.0070.01417.86
8.4.10.0040.01217.72
8.3.140.0040.00418.34
8.3.130.0080.00018.33
8.3.120.0030.00619.02
8.3.110.0090.00920.94
8.3.100.0030.00616.45
8.3.90.0120.00018.36
8.3.80.0000.00918.31
8.3.70.0110.00416.75
8.3.60.0070.01418.30
8.3.50.0100.00922.09
8.3.40.0120.00318.64
8.3.30.0140.00019.11
8.3.20.0040.00420.21
8.3.10.0070.00023.70
8.3.00.0070.00022.27
8.2.260.0100.00717.30
8.2.250.0050.00318.51
8.2.240.0060.01317.29
8.2.230.0080.00022.58
8.2.220.0050.00524.06
8.2.210.0040.00426.77
8.2.200.0060.00316.75
8.2.190.0090.00616.58
8.2.180.0100.00316.32
8.2.170.0140.00022.96
8.2.160.0170.00019.22
8.2.150.0080.00024.18
8.2.140.0000.01424.66
8.2.130.0000.00726.16
8.2.120.0040.00417.63
8.2.110.0040.00722.25
8.2.100.0080.00417.63
8.2.90.0000.00819.22
8.2.80.0060.00317.97
8.2.70.0040.00417.63
8.2.60.0040.00417.80
8.2.50.0040.00418.07
8.2.40.0030.00621.11
8.2.30.0040.00418.13
8.2.20.0050.00317.69
8.2.10.0040.00418.01
8.2.00.0000.00718.07
8.1.310.0030.01416.93
8.1.300.0040.00417.77
8.1.290.0090.00018.88
8.1.280.0040.01125.92
8.1.270.0110.00023.99
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0030.00623.92
8.1.230.0090.00317.42
8.1.220.0110.00017.74
8.1.210.0060.00318.77
8.1.200.0030.00617.13
8.1.190.0030.00517.23
8.1.180.0040.00418.10
8.1.170.0000.00918.64
8.1.160.0000.00722.11
8.1.150.0080.00018.78
8.1.140.0050.00217.46
8.1.130.0000.01117.71
8.1.120.0040.00417.48
8.1.110.0080.00017.49
8.1.100.0000.00717.45
8.1.90.0000.00717.43
8.1.80.0030.00517.43
8.1.70.0070.00017.34
8.1.60.0040.00417.62
8.1.50.0000.00817.54
8.1.40.0040.00417.49
8.1.30.0000.00817.68
8.1.20.0030.00617.66
8.1.10.0000.00717.63
8.1.00.0040.00417.43
8.0.300.0070.00018.77
8.0.290.0050.00216.63
8.0.280.0000.00718.44
8.0.270.0000.00817.21
8.0.260.0030.00317.27
8.0.250.0040.00416.84
8.0.240.0040.00416.89
8.0.230.0070.00016.94
8.0.220.0060.00016.83
8.0.210.0070.00016.78
8.0.200.0070.00016.96
8.0.190.0030.00516.87
8.0.180.0040.00416.89
8.0.170.0000.00716.94
8.0.160.0070.00016.89
8.0.150.0030.00616.77
8.0.140.0080.00016.85
8.0.130.0050.00013.30
8.0.120.0000.00816.88
8.0.110.0040.00416.82
8.0.100.0050.00216.80
8.0.90.0040.00416.93
8.0.80.0120.00316.87
8.0.70.0040.00416.96
8.0.60.0070.00017.01
8.0.50.0050.00216.84
8.0.30.0090.00917.10
8.0.20.0090.01017.40
8.0.10.0000.00717.00
8.0.00.0090.01116.67
7.4.330.0050.00015.14
7.4.320.0070.00016.60
7.4.300.0030.00316.56
7.4.290.0070.00016.42
7.4.280.0080.00016.41
7.4.270.0000.00716.50
7.4.260.0060.00316.57
7.4.250.0070.00016.58
7.4.240.0030.00316.55
7.4.230.0030.00316.50
7.4.220.0130.01316.62
7.4.210.0030.01716.63
7.4.200.0070.00016.42
7.4.160.0130.00316.46
7.4.150.0080.00917.40
7.4.140.0130.00717.86
7.4.130.0100.00716.41
7.4.120.0090.00916.44
7.4.110.0140.00316.43
7.4.100.0130.01016.44
7.4.90.0100.01016.57
7.4.80.0170.00719.39
7.4.70.0090.00916.49
7.4.60.0070.01016.61
7.4.50.0050.00316.57
7.4.40.0140.00316.62
7.4.30.0150.00316.49
7.4.00.0030.01414.82
7.3.330.0000.00613.17
7.3.320.0070.00013.30
7.3.310.0070.00016.39
7.3.300.0070.00016.14
7.3.290.0070.00816.29
7.3.280.0080.00916.27
7.3.270.0100.00617.40
7.3.260.0110.01416.22
7.3.250.0090.01016.31
7.3.240.0170.00316.35
7.3.230.0140.00316.39
7.3.210.0040.01416.35
7.3.200.0070.01016.35
7.3.190.0090.00616.62
7.3.180.0070.01016.25
7.3.170.0060.00916.53
7.3.160.0070.01016.51
7.3.10.0030.00616.69
7.3.00.0090.00016.67
7.2.330.0070.01016.70
7.2.320.0090.01316.75
7.2.310.0040.01316.29
7.2.300.0200.00316.43
7.2.290.0090.01216.44
7.2.130.0030.00916.69
7.2.120.0030.00716.72
7.2.110.0100.00716.92
7.2.100.0100.00316.41
7.2.90.0090.00416.42
7.2.80.0100.00717.02
7.2.70.0080.00316.70
7.2.60.0030.00816.83
7.2.50.0110.00317.03
7.2.40.0110.00416.81
7.2.30.0060.00917.12
7.2.20.0040.01116.91
7.2.10.0070.00716.98
7.2.00.0100.00518.21
7.1.250.0000.01115.74
7.1.200.0030.01015.54
7.1.100.0510.00918.28
7.1.70.0110.00317.27
7.1.60.0100.01419.23
7.1.50.0030.02117.11
7.1.00.0000.08022.33
7.0.200.0050.00516.84
7.0.60.0070.08020.00
7.0.50.0030.08317.87
7.0.40.0100.06020.07
7.0.30.0430.07720.09
7.0.20.0430.07320.07
7.0.10.0230.05320.08
7.0.00.0230.03720.16
5.6.280.0030.05321.12
5.6.210.0070.04720.64
5.6.200.0130.04018.29
5.6.190.0070.08720.34
5.6.180.0330.08020.48
5.6.170.0230.04320.49
5.6.160.0100.07320.50
5.6.150.0100.07718.18
5.6.140.0000.05718.18
5.6.130.0100.04018.16
5.6.120.0170.07021.07
5.6.110.0100.06021.00
5.6.100.0030.04321.10
5.6.90.0030.08721.01
5.6.80.0030.03720.52
5.6.70.3770.03720.38
5.5.350.0100.08020.41
5.5.340.0030.05717.98
5.5.330.0000.04720.56
5.5.320.0270.07720.36
5.5.310.0270.07320.30
5.5.300.0000.07718.04
5.5.290.0100.03317.98
5.5.280.0100.07720.82
5.5.270.0070.04720.88
5.5.260.0070.03720.89
5.5.250.0030.08720.71
5.5.240.0230.07020.18
5.4.450.0730.06319.16
5.4.440.0730.05719.45
5.4.430.0870.04719.63
5.4.420.0800.05719.16
5.4.410.0730.05319.04
5.4.400.0770.04719.26
5.4.390.0730.05718.87
5.4.380.0830.05319.15
5.4.370.0600.06319.06
5.4.360.0830.06019.26
5.4.350.0770.04719.06
5.4.340.1000.05719.26
5.4.320.1000.04718.86
5.4.310.0970.05018.84
5.4.300.0970.05018.84
5.4.290.0900.06019.15
5.4.280.1070.04719.25
5.4.270.0770.04719.28
5.4.260.0700.05319.28
5.4.250.0830.04318.85
5.4.240.0800.05019.12
5.4.230.0770.05019.00
5.4.220.0830.04719.26
5.4.210.0700.05719.14
5.4.200.0730.05016.93
5.4.190.0730.05019.10
5.4.180.0900.05318.93
5.4.170.0870.04319.28
5.4.160.0730.05019.13
5.4.150.0770.05019.13
5.4.140.0630.05716.59
5.4.130.0730.05316.61
5.4.120.0730.05716.46
5.4.110.0700.05016.36
5.4.100.0770.05316.56
5.4.90.0700.05716.46
5.4.80.0770.05016.54
5.4.70.0670.06016.53
5.4.60.0670.05316.54
5.4.50.0730.04716.53
5.4.40.0700.05016.53
5.4.30.0770.04316.41
5.4.20.0800.05316.50
5.4.10.0730.04716.38
5.4.00.0700.05016.02
5.3.290.0900.04014.60
5.3.280.0930.05314.50
5.3.270.1000.05714.61
5.3.260.0900.05714.48
5.3.250.0970.05014.76
5.3.240.0830.06014.52
5.3.230.1130.05714.69
5.3.220.0830.04314.44
5.3.210.0670.05714.59
5.3.200.0900.05314.63
5.3.190.0900.04714.49
5.3.180.0970.04714.57
5.3.170.0930.04714.49
5.3.160.1030.04714.48
5.3.150.0970.05714.47
5.3.140.0900.04714.47
5.3.130.0930.05314.52
5.3.120.0730.05714.61
5.3.110.0730.05314.56
5.3.100.0700.05013.93
5.3.90.0900.05314.17
5.3.80.0800.04313.95
5.3.70.0800.04713.97
5.3.60.0700.05314.16
5.3.50.0970.05013.87
5.3.40.0770.06313.98
5.3.30.0900.05713.93
5.3.20.0970.04313.63
5.3.10.0730.05013.68
5.3.00.0800.04313.67
5.2.170.0800.04011.20
5.2.160.0730.04711.15
5.2.150.0770.04311.06
5.2.140.0630.04011.15
5.2.130.0670.03711.25
5.2.120.0600.04311.02
5.2.110.0730.04311.01
5.2.100.0730.04311.12
5.2.90.0770.03711.06
5.2.80.0730.05011.00
5.2.70.0630.04011.10
5.2.60.0870.04010.95
5.2.50.0800.04011.09
5.2.40.0600.04010.86
5.2.30.0670.04010.89
5.2.20.0600.04010.87
5.2.10.0800.03010.88
5.2.00.0500.04310.69
5.1.60.0470.0339.84
5.1.50.0430.0409.93
5.1.40.0430.0379.87
5.1.30.0500.03310.21
5.1.20.0470.03710.41
5.1.10.0500.04010.01
5.1.00.0630.0339.91
5.0.50.0330.0278.61
5.0.40.0300.0238.39
5.0.30.0200.0478.23
5.0.20.0230.0338.23
5.0.10.0270.0308.15
5.0.00.0270.0438.21
4.4.90.0330.0135.76
4.4.80.0300.0205.87
4.4.70.0300.0205.76
4.4.60.0300.0205.92
4.4.50.0330.0205.80
4.4.40.0300.0375.90
4.4.30.0270.0235.88
4.4.20.0270.0235.98
4.4.10.0230.0235.87
4.4.00.0230.0435.87
4.3.110.0330.0175.69
4.3.100.0270.0235.71
4.3.90.0300.0205.73
4.3.80.0300.0335.82
4.3.70.0270.0235.72
4.3.60.0400.0135.74
4.3.50.0270.0205.67
4.3.40.0330.0235.74
4.3.30.0100.0234.54
4.3.20.0130.0234.48
4.3.10.0130.0234.39
4.3.00.0000.0237.16

preferences:
81.81 ms | 403 KiB | 5 Q