3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public function foo() { echo "I am only called once.\n"; return array('a', 'b', 'c', 'd', 'e'); } public function count($arr) { echo "I am only called once.\n"; return count($arr); } } $test = new Test(); foreach ($test->foo() as $value) { echo $value . "\n"; } $arr = array(1,2,3,4,5); for($i=0; $i < $test->count($arr); ++$i) { echo $arr[$i] . "\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.3.60.0090.00918.42
8.3.50.0100.01021.14
8.3.40.0040.01118.84
8.3.30.0110.00420.20
8.3.20.0040.00420.19
8.3.10.0040.00422.10
8.3.00.0070.00022.37
8.2.180.0220.00016.75
8.2.170.0070.00722.96
8.2.160.0070.00720.69
8.2.150.0040.00424.18
8.2.140.0060.00324.66
8.2.130.0090.00926.16
8.2.120.0040.00419.56
8.2.110.0060.00622.32
8.2.100.0000.01217.84
8.2.90.0080.00017.88
8.2.80.0060.00319.11
8.2.70.0050.00317.93
8.2.60.0090.00018.16
8.2.50.0080.00018.10
8.2.40.0050.00220.59
8.2.30.0070.00018.06
8.2.20.0040.00417.82
8.2.10.0040.00417.74
8.2.00.0050.00217.75
8.1.280.0180.00425.92
8.1.270.0080.00024.66
8.1.260.0030.00526.35
8.1.250.0030.00528.09
8.1.240.0040.00423.84
8.1.230.0110.00020.88
8.1.220.0050.00317.79
8.1.210.0130.00318.77
8.1.200.0100.00017.22
8.1.190.0060.00317.22
8.1.180.0040.00418.10
8.1.170.0030.00618.46
8.1.160.0040.00422.10
8.1.150.0040.00418.64
8.1.140.0070.00017.36
8.1.130.0030.00317.89
8.1.120.0040.00417.47
8.1.110.0070.00017.45
8.1.100.0020.00517.42
8.1.90.0000.00817.45
8.1.80.0030.00317.44
8.1.70.0030.00317.35
8.1.60.0030.00617.58
8.1.50.0000.00817.45
8.1.40.0070.00017.55
8.1.30.0000.00817.67
8.1.20.0000.00817.71
8.1.10.0000.00917.48
8.1.00.0050.00517.50
8.0.300.0080.00019.69
8.0.290.0080.00016.63
8.0.280.0050.00318.45
8.0.270.0000.00717.11
8.0.260.0000.00618.51
8.0.250.0060.00016.96
8.0.240.0000.00716.95
8.0.230.0000.00716.85
8.0.220.0000.00716.88
8.0.210.0070.00016.78
8.0.200.0000.00616.82
8.0.190.0080.00416.93
8.0.180.0030.00716.87
8.0.170.0050.00316.94
8.0.160.0050.00316.93
8.0.150.0000.00716.89
8.0.140.0040.00416.86
8.0.130.0000.00513.41
8.0.120.0040.00416.83
8.0.110.0040.00416.88
8.0.100.0050.00216.88
8.0.90.0000.00716.88
8.0.80.0060.01316.90
8.0.70.0040.00416.94
8.0.60.0070.00016.89
8.0.50.0070.00016.96
8.0.30.0090.01017.05
8.0.20.0110.00917.40
8.0.10.0040.00417.03
8.0.00.0060.01216.93
7.4.330.0070.00015.00
7.4.320.0030.00316.64
7.4.300.0000.00616.55
7.4.290.0070.00016.61
7.4.280.0000.00616.57
7.4.270.0070.00016.51
7.4.260.0000.01016.52
7.4.250.0070.00016.56
7.4.240.0040.00316.57
7.4.230.0040.00416.54
7.4.220.0060.01216.69
7.4.210.0140.00516.58
7.4.200.0030.00316.34
7.4.190.0030.00416.69
7.4.160.0130.00916.50
7.4.150.0120.00417.40
7.4.140.0080.01317.86
7.4.130.0100.00716.54
7.4.120.0110.00716.59
7.4.110.0150.00616.52
7.4.100.0070.01416.44
7.4.90.0160.00816.45
7.4.80.0040.01519.39
7.4.70.0130.01016.61
7.4.60.0120.00616.55
7.4.50.0000.00616.50
7.4.40.0070.00322.77
7.4.30.0110.00716.35
7.4.00.0070.00715.21
7.3.330.0000.00513.31
7.3.320.0000.00513.17
7.3.310.0030.00316.33
7.3.300.0000.00616.30
7.3.290.0040.01116.31
7.3.280.0080.00916.32
7.3.270.0170.00017.40
7.3.260.0120.00616.29
7.3.250.0030.01316.63
7.3.240.0070.01016.42
7.3.230.0070.01416.51
7.3.210.0100.01316.50
7.3.200.0100.00719.39
7.3.190.0090.01416.41
7.3.180.0090.00616.43
7.3.170.0070.01316.51
7.3.160.0030.01516.61
7.3.120.0060.00614.89
7.3.10.0050.00816.70
7.3.00.0070.00616.71
7.2.330.0040.01416.52
7.2.320.0060.01216.46
7.2.310.0000.01716.68
7.2.300.0060.01016.70
7.2.290.0060.01116.78
7.2.130.0080.00716.96
7.2.120.0100.00516.91
7.2.110.0000.01017.16
7.2.100.0070.00716.86
7.2.90.0060.00817.06
7.2.80.0050.01216.99
7.2.70.0050.01216.79
7.2.60.0070.00416.91
7.2.50.0070.00916.87
7.2.40.0070.00716.93
7.2.30.0010.01217.08
7.2.20.0050.00917.08
7.2.10.0100.00616.92
7.2.00.0080.00517.69
7.1.250.0070.00515.98
7.1.100.0040.00718.32
7.1.70.0040.01117.38
7.1.60.0000.02419.29
7.1.50.0070.01716.93
7.1.00.0030.07722.46
7.0.200.1700.00714.86
7.0.140.0000.07721.95
7.0.60.0100.08020.03
7.0.50.0000.04717.86
7.0.40.0230.07020.09
7.0.30.0230.06020.16
7.0.20.0300.05720.15
7.0.10.0070.08720.15
7.0.00.0130.07720.18
5.6.280.0070.07020.91
5.6.210.0170.07320.52
5.6.200.0070.08018.16
5.6.190.0070.07720.57
5.6.180.0230.04720.75
5.6.170.0270.05320.54
5.6.160.0100.08020.56
5.6.150.0030.05718.23
5.6.140.0030.04318.19
5.6.130.0130.04718.21
5.6.120.0170.07720.99
5.6.110.0100.07720.95
5.6.100.0170.07021.11
5.6.90.0100.08020.97
5.6.80.0200.05020.51
5.5.350.3870.04020.35
5.5.340.0030.06017.95
5.5.330.0170.07720.40
5.5.320.0370.06720.20
5.5.310.0170.05020.18
5.5.300.0070.06317.97
5.5.290.0100.06318.08
5.5.280.0070.04020.77
5.5.270.0070.08020.76
5.5.260.0070.07720.86
5.5.250.0070.08020.70
5.5.240.0270.03720.04
5.4.450.0070.04719.20
5.4.440.0130.04019.29
5.4.430.0230.03019.41
5.4.420.0230.03019.40
5.4.410.0230.03019.19
5.4.400.0130.04019.17
5.4.390.0100.04019.16
5.4.380.0230.03318.95
5.4.370.0200.03019.14
5.4.360.0170.03719.00
5.4.350.0170.03319.05
5.4.340.0130.04019.12
5.4.320.0170.03718.84
5.4.310.0070.04319.00
5.4.300.0100.04019.16
5.4.290.0100.04719.16
5.4.280.0170.04319.16
5.4.270.0200.03019.23
5.4.260.0130.04018.83
5.4.250.0130.04018.85
5.4.240.0100.04018.86
5.4.230.0130.03719.32
5.4.220.0170.03719.14
5.4.210.0230.03019.30
5.4.200.0100.04318.94
5.4.190.0200.05718.83
5.4.180.0130.04019.13
5.4.170.0270.07019.09
5.4.160.0270.03318.96
5.4.150.0370.05718.98
5.4.140.0300.03716.33
5.4.130.0230.06316.67
5.4.120.0330.04316.30
5.4.110.0230.06716.59
5.4.100.0170.04016.37
5.4.90.0200.03016.36
5.4.80.0200.05316.40
5.4.70.0130.04316.50
5.4.60.0170.03716.52
5.4.50.0270.04716.53
5.4.40.0170.07016.49
5.4.30.0200.04716.25
5.4.20.0200.04016.25
5.4.10.0270.05716.37
5.4.00.0200.04015.91
5.3.290.0270.04015.45
5.3.280.0200.05015.45
5.3.270.0130.05715.45
5.3.260.0230.08015.45
5.3.250.0230.06715.45
5.3.240.0230.04315.45
5.3.230.0270.07015.45
5.3.220.0300.04015.45
5.3.210.0330.07015.45
5.3.200.0200.04715.45
5.3.190.0230.03715.45
5.3.180.0200.08015.45
5.3.170.0270.03715.45
5.3.160.0270.04315.45
5.3.150.0300.04015.45
5.3.140.0200.07715.45
5.3.130.0200.05015.45
5.3.120.0270.04315.45
5.3.110.0230.05715.45
5.3.100.0100.05715.45
5.3.90.0230.06315.45
5.3.80.0230.04315.45
5.3.70.0300.03015.45
5.3.60.0230.05715.45
5.3.50.0200.03715.45
5.3.40.0130.05715.45
5.3.30.0230.04715.45
5.3.20.0230.04315.45
5.3.10.0170.06015.45
5.3.00.0200.04315.45
5.2.170.0170.03015.45
5.2.160.0170.06015.45
5.2.150.0130.03315.45
5.2.140.0170.04315.45
5.2.130.0170.03015.45
5.2.120.0200.06015.45
5.2.110.0130.03015.45
5.2.100.0170.04315.45
5.2.90.0170.02715.45
5.2.80.0170.04015.45
5.2.70.0200.05715.45
5.2.60.0170.04315.45
5.2.50.0200.03715.45
5.2.40.0130.06315.45
5.2.30.0130.04715.45
5.2.20.0200.05015.45
5.2.10.0300.04715.45
5.2.00.0170.05715.45
5.1.60.0170.05315.45
5.1.50.0200.04715.45
5.1.40.0170.02715.45
5.1.30.0200.05015.45
5.1.20.0200.03015.45
5.1.10.0130.04315.45
5.1.00.0130.04015.45
5.0.50.0130.04315.45
5.0.40.0130.02015.45
5.0.30.0070.04015.45
5.0.20.0100.04015.45
5.0.10.0070.04315.45
5.0.00.0070.05015.45
4.4.90.0100.01315.45
4.4.80.0100.01315.45
4.4.70.0100.03015.45
4.4.60.0130.02315.45
4.4.50.0070.02715.45
4.4.40.0070.03315.45
4.4.30.0100.01715.45
4.4.20.0030.04015.45
4.4.10.0070.02015.45
4.4.00.0100.05315.45
4.3.110.0100.03315.45
4.3.100.0100.02015.45
4.3.90.0070.02015.45
4.3.80.0130.02315.45
4.3.70.0070.01715.45
4.3.60.0070.02015.45
4.3.50.0030.01715.45
4.3.40.0130.04715.45
4.3.30.0070.03315.45
4.3.20.0030.03015.45
4.3.10.0000.02715.45
4.3.00.0030.01315.45

preferences:
43.51 ms | 401 KiB | 5 Q