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 ArraIterator('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.0150.00316.63
8.3.50.0110.00821.89
8.3.40.0120.00318.66
8.3.30.0140.00018.98
8.3.20.0000.00720.29
8.3.10.0060.00323.36
8.3.00.0040.00419.72
8.2.180.0090.00618.70
8.2.170.0070.00722.96
8.2.160.0070.00720.58
8.2.150.0050.00324.18
8.2.140.0030.00624.66
8.2.130.0060.00319.27
8.2.120.0080.00026.35
8.2.110.0030.00622.30
8.2.100.0040.00718.04
8.2.90.0000.00819.08
8.2.80.0000.00817.97
8.2.70.0060.00317.63
8.2.60.0030.00517.68
8.2.50.0040.00418.07
8.2.40.0000.00822.16
8.2.30.0040.00420.48
8.2.20.0040.00417.63
8.2.10.0040.00417.93
8.2.00.0000.00718.05
8.1.280.0110.00725.92
8.1.270.0100.01020.25
8.1.260.0040.00428.09
8.1.250.0040.00428.09
8.1.240.0140.00723.79
8.1.230.0080.00319.16
8.1.220.0000.00817.74
8.1.210.0060.00618.77
8.1.200.0030.00617.48
8.1.190.0050.00317.00
8.1.180.0030.00618.10
8.1.170.0080.00018.59
8.1.160.0030.00520.83
8.1.150.0000.00718.82
8.1.140.0030.00519.48
8.1.130.0040.00417.65
8.1.120.0070.00017.40
8.1.110.0070.00417.34
8.1.100.0080.00017.50
8.1.90.0070.00017.45
8.1.80.0040.00417.52
8.1.70.0060.00317.50
8.1.60.0000.00817.59
8.1.50.0040.00417.42
8.1.40.0000.00817.41
8.1.30.0000.00817.73
8.1.20.0020.00517.63
8.1.10.0030.00617.57
8.1.00.0040.00417.53
8.0.300.0040.00418.77
8.0.290.0040.00416.63
8.0.280.0070.00018.45
8.0.270.0070.00017.27
8.0.260.0060.00017.25
8.0.250.0030.00316.93
8.0.240.0070.00016.92
8.0.230.0080.00017.02
8.0.220.0000.00916.99
8.0.210.0000.00816.87
8.0.200.0000.00717.05
8.0.190.0060.00317.06
8.0.180.0000.00717.00
8.0.170.0000.00817.05
8.0.160.0040.00416.96
8.0.150.0050.00316.80
8.0.140.0060.00316.90
8.0.130.0030.00313.39
8.0.120.0080.00016.92
8.0.110.0000.00716.97
8.0.100.0050.00216.90
8.0.90.0040.00416.94
8.0.80.0070.00717.03
8.0.70.0000.00717.00
8.0.60.0000.00717.03
8.0.50.0000.00816.96
8.0.30.0160.00416.99
8.0.20.0100.01117.40
8.0.10.0040.00417.14
8.0.00.0090.01116.66
7.4.330.0060.00016.79
7.4.320.0040.00416.64
7.4.300.0000.00716.54
7.4.290.0030.00316.55
7.4.280.0040.00416.42
7.4.270.0030.00316.51
7.4.260.0070.00016.48
7.4.250.0000.00916.58
7.4.240.0040.00316.51
7.4.230.0040.00416.69
7.4.220.0150.01116.64
7.4.210.0040.01116.43
7.4.200.0000.00716.70
7.4.160.0030.01216.48
7.4.150.0110.00717.40
7.4.140.0110.00817.86
7.4.130.0070.01016.53
7.4.120.0110.00716.46
7.4.110.0070.01016.52
7.4.100.0070.01116.55
7.4.90.0110.01416.66
7.4.80.0180.00019.39
7.4.70.0040.01416.54
7.4.60.0090.00616.45
7.4.50.0070.00716.65
7.4.40.0060.01516.45
7.4.30.0150.00316.30
7.4.10.0090.00914.96
7.4.00.0050.01215.04
7.3.330.0050.00213.36
7.3.320.0030.00313.29
7.3.310.0030.00316.21
7.3.300.0070.00016.36
7.3.290.0080.00716.33
7.3.280.0090.00716.35
7.3.270.0100.00617.40
7.3.260.0090.01216.48
7.3.250.0130.00616.56
7.3.240.0060.01116.60
7.3.230.0060.01016.39
7.3.210.0090.01216.44
7.3.200.0090.00616.41
7.3.190.0090.01216.36
7.3.180.0080.00816.46
7.3.170.0070.01116.38
7.3.160.0080.00816.70
7.3.130.0070.00715.11
7.3.120.0050.00514.85
7.3.110.0000.01714.86
7.3.100.0090.00614.97
7.3.90.0060.01014.62
7.3.80.0040.00714.98
7.3.70.0120.00314.66
7.3.60.0070.00714.72
7.3.50.0060.00314.74
7.3.40.0040.00415.02
7.3.30.0040.01214.69
7.3.20.0090.00616.72
7.3.10.0090.00916.62
7.3.00.0070.01116.40
7.2.330.0120.01216.72
7.2.320.0090.00916.70
7.2.310.0130.00316.40
7.2.300.0120.00616.54
7.2.290.0140.00316.64
7.2.260.0070.00615.04
7.2.250.0070.00714.83
7.2.240.0040.01115.13
7.2.230.0120.00315.26
7.2.220.0120.00314.85
7.2.210.0030.00915.13
7.2.200.0100.01015.27
7.2.190.0080.01115.23
7.2.180.0040.00814.80
7.2.170.0000.01215.22
7.2.160.0090.00615.03
7.2.150.0040.01217.05
7.2.140.0030.00916.99
7.2.130.0100.00616.73
7.2.120.0120.00816.94
7.2.110.0140.00516.86
7.2.100.0060.01016.49
7.2.90.0080.00816.65
7.2.80.0120.00816.70
7.2.70.0050.01216.85
7.2.60.0110.00816.98
7.2.50.0110.00616.70
7.2.40.0180.00816.78
7.2.30.0140.00616.74
7.2.20.0120.00916.74
7.2.10.0090.01116.57
7.2.00.0070.01217.79
7.1.330.0070.00715.89
7.1.320.0000.00915.82
7.1.310.0130.00315.96
7.1.300.0030.00615.99
7.1.290.0060.00615.97
7.1.280.0080.00315.79
7.1.270.0030.00915.50
7.1.260.0040.00415.50
7.1.250.0100.00815.61
7.1.240.0070.00716.02
7.1.230.0090.00015.85
7.1.220.0060.00615.88
7.1.210.0140.00415.79
7.1.200.0060.01015.83
7.1.190.0060.01215.78
7.1.180.0000.00915.81
7.1.170.0070.01015.65
7.1.160.0040.01215.79
7.1.150.0000.01415.80
7.1.140.0030.00915.94
7.1.130.0070.01015.82
7.1.120.0060.00915.79
7.1.110.0030.01315.71
7.1.100.0030.01015.71
7.1.90.0030.01315.81
7.1.80.0030.00716.00
7.1.70.0050.00716.47
7.1.60.0040.00716.42
7.1.50.0110.00916.21
7.1.40.0000.00915.84
7.1.30.0120.00015.93
7.1.20.0000.01315.73
7.1.10.0070.00415.83
7.1.00.0030.04519.07
7.0.330.0060.00615.52
7.0.320.0090.00315.26
7.0.310.0000.01515.19
7.0.300.0040.00515.47
7.0.290.0030.01015.10
7.0.280.0040.00815.52
7.0.270.0030.01215.54
7.0.260.0060.00315.56
7.0.250.0070.00715.46
7.0.240.0080.00815.54
7.0.230.0000.01615.31
7.0.220.0000.01515.64
7.0.210.0000.01415.37
7.0.200.0030.00716.09
7.0.190.0030.01015.39
7.0.180.0030.00715.22
7.0.170.0040.00715.44
7.0.160.0080.00815.41
7.0.150.0040.00815.39
7.0.140.0150.00015.57
7.0.130.0060.00915.40
7.0.120.0040.00715.07
7.0.110.0100.00315.17
7.0.100.0100.00315.27
7.0.90.0000.01815.57
7.0.80.0030.00915.43
7.0.70.0070.00715.51
7.0.60.0060.03818.74
7.0.50.0050.04516.72
7.0.40.0080.02216.91
7.0.30.0120.02716.86
7.0.20.0180.04416.91
7.0.10.0070.03516.67
7.0.00.0050.04916.87
5.6.400.0000.00814.66
5.6.390.0030.01014.20
5.6.380.0030.00914.70
5.6.370.0090.00614.20
5.6.360.0060.00914.65
5.6.350.0110.00714.45
5.6.340.0030.01013.90
5.6.330.0100.01014.80
5.6.320.0040.01214.32
5.6.310.0030.01014.53
5.6.300.0160.00314.66
5.6.290.0070.00414.20
5.6.280.0050.01717.79
5.6.270.0150.00014.46
5.6.260.0040.01114.37
5.6.250.0060.00914.45
5.6.240.0060.01314.30
5.6.230.0060.00614.20
5.6.220.0090.00614.35
5.6.210.0100.04117.60
5.6.200.0080.03516.31
5.6.190.0050.04617.63
5.6.180.0200.04217.46
5.6.170.0130.03217.54
5.6.160.0030.04017.49
5.6.150.0050.02616.16
5.6.140.0090.03416.39
5.6.130.0080.04216.25
5.6.120.0070.03217.74
5.6.110.0040.04817.73
5.6.100.0050.04817.79
5.6.90.0080.03017.63
5.6.80.0120.04217.47
5.6.70.0070.00714.39
5.6.60.0060.00314.29
5.6.50.0030.00514.23
5.6.40.0070.00714.20
5.6.30.0100.00714.37
5.6.20.0050.00314.64
5.6.10.0070.00714.59
5.6.00.0050.00514.38
5.5.380.0030.01414.30
5.5.370.0030.00614.57
5.5.360.0030.00614.37
5.5.350.1750.02717.33
5.5.340.0070.04616.29
5.5.330.0070.03517.21
5.5.320.0080.02917.41
5.5.310.0120.03417.33
5.5.300.0020.03116.15
5.5.290.0050.02716.30
5.5.280.0080.03217.67
5.5.270.0060.04517.64
5.5.260.0060.05117.51
5.5.250.0130.03517.56
5.5.240.0070.04017.15
5.5.230.0000.01414.22
5.5.220.0040.01114.08
5.5.210.0090.00614.03
5.5.200.0030.01214.22
5.5.190.0050.00514.42
5.5.180.0060.00314.36
5.5.170.0130.00314.45
5.5.160.0040.01114.30
5.5.150.0000.01514.04
5.5.140.0030.00614.07
5.5.130.0090.00614.21
5.5.120.0110.00314.43
5.5.110.0060.00914.34
5.5.100.0060.01214.36
5.5.90.0100.00314.20
5.5.80.0030.01414.38
5.5.70.0030.00714.10
5.5.60.0070.00714.42
5.5.50.0030.01014.26
5.5.40.0000.01314.39
5.5.30.0000.01214.08
5.5.20.0070.00714.13
5.5.10.0080.00414.26
5.5.00.0060.00714.18

preferences:
37.15 ms | 401 KiB | 5 Q