3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Derp implements Iterator { protected $index; protected $array; public function __construct(array $input) { $this->array = $input; } public function current() { return $this->array[$this->index]; } public function next() { $this->index += 1; } public function key() { return $this->index; } public function valid() { return isset($this->array[$this->index]); } public function rewind() { $this->index = 0; } } $d = new Derp(range(1,100)); echo $items instanceof Traversable ? 'It\'s an array!' : 'Not an array.'; foreach($d as $key => $value) { echo "\n$key => $value"; }

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.0110.00716.63
8.3.50.0140.00322.08
8.3.40.0120.00318.73
8.3.30.0140.00019.27
8.3.20.0080.00020.34
8.3.10.0050.00323.66
8.3.00.0080.00022.45
8.2.180.0100.00616.38
8.2.170.0140.00422.96
8.2.160.0070.01320.40
8.2.150.0050.00324.18
8.2.140.0000.00924.66
8.2.130.0080.00626.16
8.2.120.0000.00722.25
8.2.110.0030.00622.09
8.2.100.0070.00417.71
8.2.90.0040.00419.25
8.2.80.0080.00017.97
8.2.70.0090.00017.75
8.2.60.0030.00518.05
8.2.50.0060.00318.07
8.2.40.0050.00319.41
8.2.30.0080.00018.13
8.2.20.0040.00417.85
8.2.10.0000.00817.80
8.2.00.0040.00417.80
8.1.280.0090.00625.92
8.1.270.0030.00623.92
8.1.260.0080.00026.35
8.1.250.0070.00028.09
8.1.240.0110.00723.87
8.1.230.0080.00319.14
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0070.00317.36
8.1.190.0000.00817.65
8.1.180.0040.00418.10
8.1.170.0040.00418.66
8.1.160.0040.00422.04
8.1.150.0070.00018.56
8.1.140.0040.00417.37
8.1.130.0030.00317.87
8.1.120.0040.00417.52
8.1.110.0000.00817.53
8.1.100.0050.00217.37
8.1.90.0020.00517.35
8.1.80.0030.00317.34
8.1.70.0070.00017.39
8.1.60.0040.00417.58
8.1.50.0000.00917.46
8.1.40.0070.00017.54
8.1.30.0080.00017.63
8.1.20.0030.00617.73
8.1.10.0040.00417.46
8.1.00.0060.00317.37
8.0.300.0000.00818.77
8.0.290.0040.00417.05
8.0.280.0070.00018.50
8.0.270.0070.00017.14
8.0.260.0040.00416.89
8.0.250.0030.00317.03
8.0.240.0030.00317.04
8.0.230.0000.00816.98
8.0.220.0000.00716.86
8.0.210.0030.00616.90
8.0.200.0040.00417.06
8.0.190.0040.00417.02
8.0.180.0000.00716.96
8.0.170.0080.00017.02
8.0.160.0040.00416.91
8.0.150.0000.00816.90
8.0.140.0050.00216.88
8.0.130.0050.00313.44
8.0.120.0040.00416.90
8.0.110.0000.00716.91
8.0.100.0040.00416.91
8.0.90.0050.00316.75
8.0.80.0130.00616.98
8.0.70.0040.00417.03
8.0.60.0040.00416.96
8.0.50.0000.00816.92
8.0.30.0060.01317.20
8.0.20.0090.01717.40
8.0.10.0050.00217.05
8.0.00.0080.01216.81
7.4.330.0020.00215.08
7.4.320.0040.00416.57
7.4.300.0030.00316.50
7.4.290.0000.00716.61
7.4.280.0030.00316.47
7.4.270.0080.00016.49
7.4.260.0070.00016.51
7.4.250.0040.00416.45
7.4.240.0060.00216.63
7.4.230.0000.00816.37
7.4.220.0110.00716.46
7.4.210.0060.00916.54
7.4.200.0000.00816.41
7.4.190.0000.00716.77
7.4.160.0110.00816.48
7.4.150.0090.00917.40
7.4.140.0110.00717.86
7.4.130.0120.00916.58
7.4.120.0040.01616.59
7.4.110.0040.01516.48
7.4.100.0060.01216.44
7.4.90.0120.00616.59
7.4.80.0100.01019.39
7.4.70.0100.01016.32
7.4.60.0130.00716.61
7.4.50.0080.00016.30
7.4.40.0070.01022.77
7.4.30.0090.00816.39
7.4.00.0040.01115.11
7.3.330.0040.00413.23
7.3.320.0000.00613.23
7.3.310.0000.00816.47
7.3.300.0030.00316.48
7.3.290.0030.01716.34
7.3.280.0130.00816.42
7.3.270.0070.01017.40
7.3.260.0070.01116.39
7.3.250.0130.00616.60
7.3.240.0130.00716.50
7.3.230.0060.01216.39
7.3.210.0120.00916.64
7.3.200.0140.00819.39
7.3.190.0100.00716.45
7.3.180.0100.00616.46
7.3.170.0140.00316.41
7.3.160.0140.01016.50
7.3.120.0040.01114.86
7.3.10.0190.00816.32
7.3.00.0170.01016.36
7.2.330.0140.00416.80
7.2.320.0070.01016.76
7.2.310.0110.01116.52
7.2.300.0130.00316.62
7.2.290.0100.00716.85
7.2.130.0130.00316.71
7.2.120.0150.00316.63
7.2.110.0000.01516.82
7.2.100.0070.01016.89
7.2.90.0030.00716.86
7.2.80.0060.00916.68
7.2.70.0130.00716.72
7.2.60.0100.00716.80
7.2.50.0070.00416.71
7.2.40.0070.01016.95
7.2.30.0060.00616.52
7.2.20.0040.01216.84
7.2.10.0000.01216.86
7.2.00.0040.01417.02
7.1.250.0080.00815.49
7.1.70.0000.00816.99
7.1.60.0110.01519.29
7.1.50.0100.01316.79
7.1.00.0030.07722.32
7.0.200.0110.00416.62
7.0.140.0000.07322.00
7.0.60.0100.07321.63
7.0.50.0130.07317.92
7.0.40.0070.07020.27
7.0.30.0300.07320.21
7.0.20.0270.07320.30
7.0.10.0070.09020.19
7.0.00.0100.07020.12
5.6.280.0100.06720.87
5.6.210.0030.04020.52
5.6.200.0100.06718.18
5.6.190.0070.04020.48
5.6.180.0430.07720.33
5.6.170.0200.03720.55
5.6.160.0170.04320.48
5.6.150.0030.06018.27
5.6.140.0000.04318.15
5.6.130.0070.04718.28
5.6.120.0100.08721.00
5.6.110.0130.06721.02
5.6.100.0270.07720.97
5.6.90.0170.04721.01
5.6.80.0000.07720.43
5.5.350.0070.07720.44
5.5.340.0000.08318.09
5.5.330.0070.03720.57
5.5.320.0330.07320.26
5.5.310.0030.05320.26
5.5.300.0070.08017.95
5.5.290.0000.05318.03
5.5.280.0070.08320.80
5.5.270.0030.08020.68
5.5.260.0100.03720.77
5.5.250.0200.07720.69
5.5.240.0230.05720.33
5.4.450.4400.04019.32
5.4.440.3230.04319.59
5.4.430.4370.04019.30
5.4.420.3770.04019.45
5.4.410.3900.04019.43
5.4.400.3900.04019.18
5.4.390.0070.03719.23
5.4.380.3900.03719.20
5.4.370.3430.03719.20
5.4.360.3770.03019.20
5.4.350.3600.03319.22
5.4.340.4200.05019.20
5.4.320.3930.03719.06
5.4.310.3830.04319.15
5.4.300.4100.03719.19
5.4.290.3900.04018.95
5.4.280.3870.04019.13
5.4.270.4100.04019.14
5.4.260.4030.04018.95
5.4.250.4230.03019.05
5.4.240.3700.03318.98
5.4.230.3670.03719.05
5.4.220.3830.04019.14
5.4.210.3830.03318.92
5.4.200.3630.03019.04
5.4.190.3670.03319.07
5.4.180.3670.03019.21
5.4.170.4630.03719.21
5.4.160.4400.03318.98
5.4.150.4370.04318.95
5.4.140.4470.03316.43
5.4.130.4270.03316.43
5.4.120.4500.02716.43
5.4.110.4400.03716.56
5.4.100.3900.03316.23
5.4.90.3870.03716.48
5.4.80.3670.02716.32
5.4.70.4430.03316.44
5.4.60.4170.03716.49
5.4.50.4100.03016.33
5.4.40.3770.02316.51
5.4.30.3600.03016.45
5.4.20.4170.03716.48
5.4.10.4000.04316.51
5.4.00.4100.04315.99
5.3.290.3930.03314.68
5.3.280.3830.03314.64
5.3.270.4130.03314.63
5.3.260.5400.04314.68
5.3.250.4730.03714.67
5.3.240.4630.03314.68
5.3.230.4630.04014.75
5.3.220.4470.04314.63
5.3.210.4130.04314.61
5.3.200.4130.03714.50
5.3.190.3670.03314.72
5.3.180.3700.03014.57
5.3.170.3930.03714.73
5.3.160.4230.03314.58
5.3.150.4100.03714.62
5.3.140.3630.03014.61
5.3.130.3800.03314.48
5.3.120.4970.04714.55
5.3.110.3900.04314.55
5.3.100.3900.03314.05
5.3.90.3800.03714.18
5.3.80.3700.04314.03
5.3.70.3730.04313.98
5.3.60.3900.03314.06
5.3.50.4400.03013.95
5.3.40.4200.04014.01
5.3.30.4000.04013.81
5.3.20.4070.03013.76
5.3.10.3970.03313.69
5.3.00.3970.03313.66
5.2.170.3730.02711.11
5.2.160.3800.02711.21
5.2.150.3500.04011.22
5.2.140.3370.03011.05
5.2.130.3530.03011.17
5.2.120.2970.03011.07
5.2.110.3130.02711.03
5.2.100.3030.02711.17
5.2.90.3030.02711.11
5.2.80.3570.03011.11
5.2.70.3270.02711.00
5.2.60.3270.03011.02
5.2.50.3270.03311.19
5.2.40.2400.03310.98
5.2.30.2800.02310.95
5.2.20.3370.03010.93
5.2.10.2430.02710.89
5.2.00.2400.03310.64
5.1.60.2470.02710.04
5.1.50.2370.02710.04
5.1.40.2400.02010.14
5.1.30.2670.02310.41
5.1.20.0030.06010.29
5.1.10.0030.03010.13
5.1.00.0030.02310.14
5.0.50.0030.0308.45
5.0.40.0570.0278.39
5.0.30.1400.0308.28
5.0.20.1170.0208.18
5.0.10.1330.0238.25
5.0.00.1400.0278.17
4.4.90.1470.0137.13
4.4.80.1370.0177.16
4.4.70.1170.0177.20
4.4.60.1400.0177.20
4.4.50.1230.0137.22
4.4.40.1200.0277.25
4.4.30.1430.0177.26
4.4.20.0000.0207.28
4.4.10.0030.0237.30
4.4.00.0000.0277.31
4.3.110.1330.0207.33
4.3.100.1170.0177.33
4.3.90.1300.0177.34
4.3.80.1300.0237.35
4.3.70.1470.0107.36
4.3.60.1300.0177.36
4.3.50.1670.0137.36
4.3.40.1230.0237.38
4.3.30.0630.0177.38
4.3.20.0600.0177.38
4.3.10.0600.0177.38
4.3.00.0600.0137.38

preferences:
38.26 ms | 401 KiB | 5 Q