3v4l.org

run code in 300+ PHP versions simultaneously
<?php class it implements OuterIterator { private $inner; public function __construct(Iterator $inner) { $this->inner = $inner; } public function getInnerIterator() { echo "++ inner\n"; return $this->inner; } public function next() { echo "-- Next\n"; return $this->inner->next(); } public function current() { echo "-- Current\n"; return $this->inner->current(); } public function key() { echo "-- Key\n"; return $this->inner->key(); } public function rewind() { echo "-- Rewind\n"; return $this->inner->rewind(); } public function valid() { echo "-- Valid\n"; return $this->inner->valid(); } } $it = new it(new ArrayIterator(array("foo", "bar"))); foreach ($it as $key => $value) { echo $value."\n"; } $array_a = new ArrayIterator(array('a', 'b', 'c')); $array_b = new ArrayIterator(array('d', 'e', 'f')); $iterator = new AppendIterator; $iterator->append($array_a); $iterator->append($array_b); foreach ($iterator as $current) { echo $current; if ($current=='e') { $iterator->append(new ArrayIterator('g','h')); } }

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.0120.00616.75
8.3.50.0040.01218.06
8.3.40.0100.01018.96
8.3.30.0000.01418.80
8.3.20.0050.00220.20
8.3.10.0050.00323.61
8.3.00.0040.00419.79
8.2.180.0180.00418.29
8.2.170.0110.00722.96
8.2.160.0030.01020.47
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0100.00019.32
8.2.120.0030.00626.35
8.2.110.0040.00422.29
8.2.100.0120.00017.93
8.2.90.0030.00619.05
8.2.80.0080.00017.97
8.2.70.0030.00617.63
8.2.60.0000.00818.03
8.2.50.0030.00618.07
8.2.40.0080.00022.32
8.2.30.0030.00520.52
8.2.20.0000.00717.77
8.2.10.0000.00818.04
8.2.00.0040.00418.01
8.1.280.0110.00725.92
8.1.270.0110.00420.27
8.1.260.0050.00328.09
8.1.250.0000.00828.09
8.1.240.0080.00023.98
8.1.230.0110.00019.02
8.1.220.0090.00017.74
8.1.210.0080.00418.77
8.1.200.0030.00717.34
8.1.190.0040.00417.22
8.1.180.0060.00318.10
8.1.170.0050.00318.59
8.1.160.0030.00620.77
8.1.150.0000.00718.90
8.1.140.0000.00819.57
8.1.130.0070.00017.70
8.1.120.0040.00417.36
8.1.110.0060.00317.47
8.1.100.0080.00017.36
8.1.90.0040.00417.44
8.1.80.0000.00717.42
8.1.70.0050.00317.45
8.1.60.0000.00717.48
8.1.50.0030.00517.54
8.1.40.0080.00017.42
8.1.30.0040.00417.57
8.1.20.0000.00817.55
8.1.10.0040.00417.51
8.1.00.0000.00817.58
8.0.300.0040.00418.77
8.0.290.0040.00416.72
8.0.280.0070.00018.45
8.0.270.0000.00817.31
8.0.260.0000.00717.25
8.0.250.0030.00317.05
8.0.240.0030.00316.96
8.0.230.0030.00316.97
8.0.220.0060.00316.85
8.0.210.0000.00716.86
8.0.200.0060.00016.93
8.0.190.0040.00416.89
8.0.180.0040.00416.95
8.0.170.0000.00816.88
8.0.160.0000.00716.80
8.0.150.0040.00416.95
8.0.140.0100.00016.91
8.0.130.0030.00313.34
8.0.120.0000.00716.90
8.0.110.0000.00716.88
8.0.100.0050.00316.89
8.0.90.0050.00316.89
8.0.80.0070.01516.91
8.0.70.0040.00416.97
8.0.60.0030.00516.85
8.0.50.0070.00016.84
8.0.30.0140.00517.09
8.0.20.0140.00817.40
8.0.10.0040.00417.04
8.0.00.0060.01616.76
7.4.330.0000.00516.71
7.4.320.0000.00616.52
7.4.300.0060.00016.63
7.4.290.0000.00716.50
7.4.280.0040.00416.64
7.4.270.0030.00316.58
7.4.260.0070.00016.59
7.4.250.0030.00616.55
7.4.240.0010.00616.57
7.4.230.0030.00316.63
7.4.220.0180.01016.52
7.4.210.0070.01416.47
7.4.200.0050.00216.50
7.4.160.0090.00616.51
7.4.150.0170.00517.40
7.4.140.0090.01117.86
7.4.130.0080.01116.49
7.4.120.0070.01216.66
7.4.110.0070.01116.62
7.4.100.0110.00716.47
7.4.90.0080.01016.70
7.4.80.0090.00919.39
7.4.70.0090.00616.50
7.4.60.0160.00316.56
7.4.50.0030.01216.64
7.4.40.0110.00516.41
7.4.30.0100.01016.65
7.4.00.0060.00915.18
7.3.330.0070.00013.15
7.3.320.0030.00313.18
7.3.310.0040.00416.23
7.3.300.0000.00716.19
7.3.290.0060.01016.33
7.3.280.0080.00816.33
7.3.270.0070.01117.40
7.3.260.0080.01716.51
7.3.250.0070.01216.52
7.3.240.0140.00316.49
7.3.230.0080.00816.64
7.3.210.0070.01016.39
7.3.200.0070.01016.39
7.3.190.0130.00316.54
7.3.180.0060.01016.41
7.3.170.0030.01616.59
7.3.160.0130.00316.45
7.2.330.0100.01416.54
7.2.320.0090.00916.46
7.2.310.0100.00616.80
7.2.300.0090.00916.54
7.2.290.0070.01416.96
7.2.80.0000.01316.56
7.2.60.0110.00417.09
7.2.00.0100.00319.09
7.1.200.0050.00815.65
7.1.100.0000.01318.46
7.1.70.0000.00917.05
7.1.60.0220.00419.52
7.1.50.0090.00616.80
7.1.00.0030.08022.33
7.0.200.0060.00316.84
7.0.60.0070.08719.93
7.0.50.0100.05717.91
7.0.40.0070.04020.09
7.0.30.0400.05720.13
7.0.20.0270.04320.15
7.0.10.0070.06020.21
7.0.00.0100.08720.23
5.6.280.0000.03721.16
5.6.210.0130.05720.63
5.6.200.0070.08718.11
5.6.190.0230.06720.46
5.6.180.0270.04720.54
5.6.170.0230.03720.48
5.6.160.0100.05020.55
5.6.150.0070.04018.25
5.6.140.0070.03718.14
5.6.130.0030.04318.14
5.6.120.0070.07721.00
5.6.110.0170.07721.04
5.6.100.0100.08720.97
5.6.90.0030.08720.98
5.6.80.0030.06020.37
5.5.350.0270.04720.35
5.5.340.0100.07717.94
5.5.330.0000.07020.28
5.5.320.0530.04320.32
5.5.310.0270.07720.41
5.5.300.0070.08318.05
5.5.290.0100.04717.96
5.5.280.0070.03720.78
5.5.270.0070.05020.98
5.5.260.0070.05720.89
5.5.250.0070.03720.48
5.5.240.0370.07020.28

preferences:
59.82 ms | 400 KiB | 5 Q