3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo implements IteratorAggregate { private $data = [ 'foo' => 'bar', 'bar' => 'baz' ]; public function getIterator() { return new ArrayIterator($this->data); } } $Foo = new Foo(); foreach($Foo as $key => &$value) { if ($key == 'foo') { echo 'we are hitting here' , PHP_EOL; $value = 'in the loop'; } } foreach($Foo as $key => $value) { echo $key, ':', $value, PHP_EOL; }

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.0170.00316.75
8.3.50.0110.00717.43
8.3.40.0120.00918.61
8.3.30.0000.01418.79
8.3.20.0030.00618.79
8.3.10.0000.00820.48
8.3.00.0040.00419.25
8.2.180.0080.00818.29
8.2.170.0070.00722.96
8.2.160.0000.02021.05
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0070.00026.16
8.2.120.0080.00019.14
8.2.110.0060.00321.18
8.2.100.0110.00017.72
8.2.90.0000.00919.42
8.2.80.0050.00219.30
8.2.70.0040.00417.63
8.2.60.0050.00317.68
8.2.50.0040.00418.07
8.2.40.0020.00518.22
8.2.30.0080.00017.96
8.2.20.0000.00717.64
8.2.10.0030.00617.61
8.2.00.0040.00417.74
8.1.280.0110.00325.92
8.1.270.0040.00424.66
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0000.00922.61
8.1.230.0080.00320.96
8.1.220.0030.00617.79
8.1.210.0000.00818.98
8.1.200.0000.01017.48
8.1.190.0040.00417.64
8.1.180.0050.00318.10
8.1.170.0030.00518.88
8.1.160.0040.00418.74
8.1.150.0060.00318.64
8.1.140.0040.00417.36
8.1.130.0030.00317.72
8.1.120.0040.00417.29
8.1.110.0000.00717.45
8.1.100.0000.00717.46
8.1.90.0070.00017.34
8.1.80.0000.00817.39
8.1.70.0000.00717.39
8.1.60.0080.00017.47
8.1.50.0040.00417.46
8.1.40.0050.00217.52
8.1.30.0040.00417.62
8.1.20.0070.00017.71
8.1.10.0050.00217.60
8.1.00.0080.00017.46
8.0.300.0000.00719.68
8.0.290.0060.00316.75
8.0.280.0030.00518.48
8.0.270.0070.00017.19
8.0.260.0030.00316.73
8.0.250.0040.00416.97
8.0.240.0040.00416.99
8.0.230.0000.00816.96
8.0.220.0030.00316.78
8.0.210.0040.00416.93
8.0.200.0000.00716.93
8.0.190.0000.00716.84
8.0.180.0040.00416.81
8.0.170.0040.00416.88
8.0.160.0050.00216.99
8.0.150.0000.00816.91
8.0.140.0090.00316.76
8.0.130.0000.00513.32
8.0.120.0000.00816.73
8.0.110.0040.00416.90
8.0.100.0000.00816.73
8.0.90.0030.00316.72
8.0.80.0080.00816.88
8.0.70.0080.00016.74
8.0.60.0000.00716.68
8.0.50.0040.00416.90
8.0.30.0090.00916.99
8.0.20.0140.00517.00
8.0.10.0030.00416.89
8.0.00.0090.00916.91
7.4.330.0050.00012.89
7.4.320.0060.00016.61
7.4.300.0000.00616.57
7.4.290.0030.00316.52
7.4.280.0050.00316.51
7.4.270.0030.00316.61
7.4.260.0000.00513.38
7.4.250.0000.00816.50
7.4.240.0050.00316.49
7.4.230.0030.00316.49
7.4.220.0110.01116.59
7.4.210.0060.00816.58
7.4.200.0030.00316.41
7.4.190.0080.00016.66
7.4.160.0030.01316.48
7.4.150.0180.00416.44
7.4.140.0100.00716.49
7.4.130.0100.00616.43
7.4.120.0070.01216.63
7.4.110.0170.00016.35
7.4.100.0060.01116.41
7.4.90.0060.01216.47
7.4.80.0030.01319.39
7.4.70.0100.00616.49
7.4.60.0100.01316.34
7.4.50.0060.00616.56
7.4.40.0110.00816.41
7.4.30.0120.00416.63
7.4.00.0110.00714.94
7.3.330.0030.00313.16
7.3.320.0030.00313.13
7.3.310.0030.00316.19
7.3.300.0030.00316.29
7.3.290.0000.01616.29
7.3.280.0090.00816.27
7.3.270.0100.00716.42
7.3.260.0030.01716.58
7.3.250.0100.00816.45
7.3.240.0090.00916.41
7.3.230.0060.01216.55
7.3.210.0090.00916.52
7.3.200.0130.00316.37
7.3.190.0030.00616.28
7.3.180.0100.00716.70
7.3.170.0120.00616.52
7.3.160.0090.00616.50
7.3.120.0040.01115.06
7.3.10.0020.00816.63
7.3.00.0020.01016.68
7.2.330.0070.01016.40
7.2.320.0060.01616.54
7.2.310.0110.00916.55
7.2.300.0140.00316.82
7.2.290.0110.00616.80
7.2.130.0060.00316.90
7.2.120.0050.00816.90
7.2.110.0020.00716.87
7.2.100.0050.01016.93
7.2.90.0070.00717.03
7.2.80.0040.00916.71
7.2.70.0130.00016.92
7.2.60.0110.00216.96
7.2.50.0050.01116.82
7.2.40.0040.00616.84
7.2.30.0030.01016.93
7.2.20.0100.00716.77
7.2.10.0020.00916.98
7.2.00.0080.00817.69
7.1.250.0030.00715.62
7.1.100.0070.00718.13
7.1.70.0040.00817.21
7.1.60.0030.02119.40
7.1.50.0160.00617.08
7.1.00.0000.07322.45
7.0.200.0070.00314.86
7.0.140.0030.07322.00
7.0.120.0070.06322.05
7.0.60.0170.07721.77
7.0.50.0070.07317.91
7.0.40.0170.08020.13
7.0.30.0300.07720.24
7.0.20.0300.06720.10
7.0.10.0070.08720.30
7.0.00.0000.06020.38
5.6.280.0000.07721.09
5.6.210.0100.07320.77
5.6.200.0100.03718.19
5.6.190.0070.04320.51
5.6.180.0200.05320.58
5.6.170.0100.05020.56
5.6.160.0030.05020.52
5.6.150.0030.04018.14
5.6.140.0070.04318.15
5.6.130.0030.04318.11
5.6.120.0070.06321.05
5.6.110.0130.07320.98
5.6.100.0100.08020.95
5.6.90.0100.08720.97
5.6.80.0000.04020.40
5.5.350.3170.03020.53
5.5.340.0070.03717.98
5.5.330.0070.05720.23
5.5.320.0030.08320.32
5.5.310.0270.08020.30
5.5.300.0170.07017.98
5.5.290.0130.07717.93
5.5.280.0100.03720.88
5.5.270.0100.08020.84
5.5.260.0070.05720.89
5.5.250.0030.08020.71
5.5.240.0300.05320.27
5.4.450.0070.07319.33
5.4.440.0070.07019.30
5.4.430.0170.04019.17
5.4.420.0030.07719.44
5.4.410.0070.07719.35
5.4.400.0030.04019.14
5.4.390.0070.06719.19
5.4.380.0130.07018.97
5.4.370.0000.05319.15
5.4.360.0100.03719.15
5.4.350.0100.07019.00
5.4.340.0100.07019.00
5.4.320.0100.07319.25
5.4.310.0030.05319.08
5.4.300.0030.04018.85
5.4.290.0130.07019.24
5.4.280.0100.05319.11
5.4.270.0030.04319.24
5.4.260.0070.07318.92
5.4.250.0070.07719.00
5.4.240.0070.07019.07
5.4.230.0100.07319.19
5.4.220.0030.04719.00
5.4.210.0000.04319.14
5.4.200.0030.08319.14
5.4.190.0070.03718.86
5.4.180.0170.06319.23
5.4.170.0070.06019.27
5.4.160.0030.08019.22
5.4.150.0000.04319.21
5.4.140.0030.03716.30
5.4.130.0070.06016.23
5.4.120.0030.04016.50
5.4.110.0070.08016.47
5.4.100.0100.06716.38
5.4.90.0100.07016.54
5.4.80.0070.04316.38
5.4.70.0070.07016.39
5.4.60.0070.07716.40
5.4.50.0000.05016.32
5.4.40.0200.03016.43
5.4.30.0100.04316.42
5.4.20.0070.03716.27
5.4.10.0130.07016.42
5.4.00.0100.05715.86
5.3.290.0070.08014.68
5.3.280.0030.04714.60
5.3.270.0070.07714.62
5.3.260.0000.04014.66
5.3.250.0100.04314.60
5.3.240.0070.06314.61
5.3.230.0070.04014.75
5.3.220.0100.03314.56
5.3.210.0030.07014.61
5.3.200.0070.07314.61
5.3.190.0130.07714.57
5.3.180.0100.04314.63
5.3.170.0070.04314.44
5.3.160.0070.07314.72
5.3.150.0070.04014.57
5.3.140.0070.07314.55
5.3.130.0100.07014.54
5.3.120.0070.04714.70
5.3.110.0070.07314.60
5.3.100.0100.07314.03
5.3.90.0100.04013.93
5.3.80.0070.04313.93
5.3.70.0070.07714.17
5.3.60.0030.08013.96
5.3.50.0070.07714.00
5.3.40.0130.07013.96
5.3.30.0070.07013.84
5.3.20.0100.06713.76
5.3.10.0070.06313.54
5.3.00.0000.06013.55
5.2.170.0200.02711.02
5.2.160.0000.06711.21
5.2.150.0070.04711.18
5.2.140.0100.05311.14
5.2.130.0000.03311.07
5.2.120.0000.03011.09
5.2.110.0000.03310.98
5.2.100.0000.03311.17
5.2.90.0030.06011.06
5.2.80.0030.05711.12
5.2.70.0000.04011.04
5.2.60.0030.03011.09
5.2.50.0100.04011.04
5.2.40.0000.04710.98
5.2.30.0070.06011.05
5.2.20.0100.02310.96
5.2.10.0070.04011.01
5.2.00.0100.02710.64
5.1.60.0000.03010.14
5.1.50.0000.04310.05
5.1.40.0000.0279.88
5.1.30.0000.02710.34
5.1.20.0070.05710.50
5.1.10.0030.0479.97
5.1.00.0070.04010.13
5.0.50.0000.0278.55
5.0.40.0000.0378.33
5.0.30.0000.0738.17
5.0.20.0000.0278.21
5.0.10.0000.0278.23
5.0.00.0070.0278.20
4.4.90.0000.0177.88
4.4.80.0000.0377.88
4.4.70.0000.0377.88
4.4.60.0030.0307.88
4.4.50.0070.0137.88
4.4.40.0000.0307.88
4.4.30.0030.0207.88
4.4.20.0000.0237.88
4.4.10.0000.0377.88
4.4.00.0030.0577.88
4.3.110.0030.0377.88
4.3.100.0000.0207.88
4.3.90.0000.0177.88
4.3.80.0000.0277.88
4.3.70.0030.0137.88
4.3.60.0030.0137.88
4.3.50.0000.0177.88
4.3.40.0030.0207.88
4.3.30.0000.0177.88
4.3.20.0030.0137.88
4.3.10.0000.0177.88
4.3.00.0000.0177.88

preferences:
45.02 ms | 401 KiB | 5 Q