3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait OuterIteratorTrait { private $inner; /** * @return bool */ function isEmpty() { $iterator = clone $this->inner; $iterator->rewind(); return !$iterator->valid(); } function rewind() { $this->inner->rewind(); } function valid() { return $this->inner->valid(); } function next() { $this->inner->next(); } function current() { return $this->inner->current(); } function key() { return $this->inner->key(); } } class MappingIterator implements Iterator { use OuterIteratorTrait; private $mapper; function __construct(\Iterator $i, callable $f) { $this->inner = $i; $this->mapper = $f; } function current() { return call_user_func($this->mapper, $this->inner->current(), $this->key()); } } $i = new ArrayIterator(array(0, 2, 4)); $mapper = new MappingIterator($i, function($val){ return 2 * $val;}); var_dump(iterator_to_array($mapper));

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.0060.00918.55
8.3.50.0130.01022.01
8.3.40.0090.00618.68
8.3.30.0070.00719.05
8.3.20.0000.00820.21
8.3.10.0040.00422.14
8.3.00.0040.00422.37
8.2.180.0070.01416.63
8.2.170.0040.01122.96
8.2.160.0040.01120.92
8.2.150.0000.00824.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0050.00319.36
8.2.110.0090.00022.11
8.2.100.0110.00017.84
8.2.90.0030.00619.30
8.2.80.0000.00817.97
8.2.70.0030.00517.63
8.2.60.0050.00318.03
8.2.50.0000.00818.07
8.2.40.0030.00618.22
8.2.30.0050.00318.00
8.2.20.0000.00717.55
8.2.10.0030.00619.47
8.2.00.0030.00517.57
8.1.280.0100.00725.92
8.1.270.0070.00022.09
8.1.260.0080.00026.35
8.1.250.0050.00328.09
8.1.240.0060.00323.85
8.1.230.0100.00019.13
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0030.00717.22
8.1.190.0000.00817.51
8.1.180.0030.00618.10
8.1.170.0060.00318.66
8.1.160.0070.00022.05
8.1.150.0040.00418.57
8.1.140.0040.00417.41
8.1.130.0000.00717.83
8.1.120.0040.00417.49
8.1.110.0050.00217.37
8.1.100.0070.00017.46
8.1.90.0040.00317.37
8.1.80.0030.00417.51
8.1.70.0080.00017.44
8.1.60.0040.00417.49
8.1.50.0050.00317.57
8.1.40.0080.00017.48
8.1.30.0000.00917.67
8.1.20.0080.00017.50
8.1.10.0000.00817.48
8.1.00.0030.00617.52
8.0.300.0030.00618.77
8.0.290.0030.00317.05
8.0.280.0030.00318.38
8.0.270.0040.00417.31
8.0.260.0000.00716.89
8.0.250.0000.00716.90
8.0.240.0000.00817.03
8.0.230.0070.00017.03
8.0.220.0030.00316.98
8.0.210.0040.00416.98
8.0.200.0060.00016.92
8.0.190.0040.00417.03
8.0.180.0000.00717.07
8.0.170.0000.00816.92
8.0.160.0000.00716.91
8.0.150.0000.00716.86
8.0.140.0060.00316.97
8.0.130.0050.00013.37
8.0.120.0000.00816.80
8.0.110.0050.00316.98
8.0.100.0040.00417.00
8.0.90.0040.00416.77
8.0.80.0110.00716.97
8.0.70.0000.00816.91
8.0.60.0040.00417.02
8.0.50.0070.00016.99
8.0.30.0120.00917.13
8.0.20.0080.01017.43
8.0.10.0030.00516.96
8.0.00.0130.00617.00
7.4.330.0000.00615.00
7.4.320.0060.00016.51
7.4.300.0030.00416.52
7.4.290.0100.00016.66
7.4.280.0070.00016.62
7.4.270.0030.00316.54
7.4.260.0030.00516.40
7.4.250.0070.00016.61
7.4.240.0050.00316.56
7.4.230.0000.00816.49
7.4.220.0060.01316.63
7.4.210.0070.00716.69
7.4.200.0000.00716.55
7.4.190.0000.00716.70
7.4.160.0080.00816.39
7.4.150.0100.01017.40
7.4.140.0150.00617.86
7.4.130.0130.01116.44
7.4.120.0030.01416.57
7.4.110.0120.00616.46
7.4.100.0070.01116.50
7.4.90.0090.00916.64
7.4.80.0140.01619.39
7.4.70.0060.01016.58
7.4.60.0120.00916.51
7.4.50.0000.00516.41
7.4.40.0120.00322.77
7.4.30.0120.00416.42
7.4.00.0000.01314.75
7.3.330.0000.00613.29
7.3.320.0030.00313.30
7.3.310.0070.00016.21
7.3.300.0070.00016.18
7.3.290.0090.00916.34
7.3.280.0130.00416.31
7.3.270.0080.00817.40
7.3.260.0060.01216.36
7.3.250.0100.00916.41
7.3.240.0040.01416.56
7.3.230.0060.01216.39
7.3.210.0090.01216.55
7.3.200.0060.01319.39
7.3.190.0090.00816.41
7.3.180.0030.01216.43
7.3.170.0060.01016.66
7.3.160.0130.00316.64
7.3.120.0090.00615.08
7.2.330.0060.01216.74
7.2.320.0160.00316.88
7.2.310.0060.01016.71
7.2.300.0000.01816.75
7.2.290.0120.00416.79
7.2.00.0040.01119.53
7.1.200.0110.00415.50
7.1.100.0030.00818.29
7.1.70.0000.00716.84
7.1.60.0030.00917.13
7.1.50.0110.01116.75
7.1.00.0000.07722.35
7.0.200.0080.00316.52
7.0.140.0000.07721.96
7.0.60.0070.08319.89
7.0.50.0130.05317.89
7.0.40.0100.04320.09
7.0.30.0230.05020.10
7.0.20.0200.03720.23
7.0.10.0130.04720.11
7.0.00.0130.04020.22
5.6.280.0130.06320.79
5.6.210.0070.04720.68
5.6.200.0070.06018.29
5.6.190.0070.08020.61
5.6.180.0200.04720.48
5.6.170.0100.04720.71
5.6.160.0100.04320.50
5.6.150.0070.08018.18
5.6.140.0100.07718.34
5.6.130.0100.03718.21
5.6.120.0100.06721.15
5.6.110.0070.08021.16
5.6.100.0100.07720.99
5.6.90.0030.06021.15
5.6.80.0130.04720.40
5.6.70.4830.03020.52
5.5.350.0030.09020.39
5.5.340.0070.07718.02
5.5.330.0170.04720.57
5.5.320.0300.07020.35
5.5.310.0270.06720.20
5.5.300.0070.06718.05
5.5.290.0100.03717.94
5.5.280.0100.07320.86
5.5.270.0030.08720.70
5.5.260.0030.07720.81
5.5.250.0130.03320.79
5.5.240.0070.07720.14
5.4.450.0570.04019.17
5.4.440.0530.04319.39
5.4.430.0770.00019.48
5.4.420.1170.00019.54
5.4.410.0130.07018.97
5.4.400.0070.05718.89
5.4.390.0200.07718.54
5.4.380.0330.05018.48
5.4.370.0270.05718.52
5.4.360.0230.05018.80
5.4.350.0200.05318.77
5.4.340.0230.05018.54
5.4.320.0040.03912.52
5.4.310.0050.04012.51
5.4.300.0110.03612.52
5.4.290.0090.04212.51
5.4.280.0060.03612.39
5.4.270.0030.04012.39
5.4.260.0080.04012.39
5.4.250.0090.04712.39
5.4.240.0080.04012.39
5.4.230.0080.04512.38
5.4.220.0040.04512.38
5.4.210.0070.03712.38
5.4.200.0060.03912.38
5.4.190.0040.03812.38
5.4.180.0040.03912.38
5.4.170.0090.03312.39
5.4.160.0050.03712.38
5.4.150.0070.03512.38
5.4.140.0060.03912.06
5.4.130.0020.04712.05
5.4.120.0040.03912.01
5.4.110.0110.04612.01
5.4.100.0040.04012.01
5.4.90.0080.03612.00
5.4.80.0060.04212.01
5.4.70.0080.03312.00
5.4.60.0100.03512.00
5.4.50.0080.03612.01
5.4.40.0060.03911.99
5.4.30.0070.03511.99
5.4.20.0100.03311.99
5.4.10.0070.03511.99
5.4.00.0060.03811.48
5.3.290.0080.05112.80
5.3.280.0090.04212.71
5.3.270.0110.04412.73
5.3.260.0090.04312.72
5.3.250.0090.03712.72
5.3.240.0080.03712.72
5.3.230.0080.03812.71
5.3.220.0050.04012.68
5.3.210.0080.03912.68
5.3.200.0070.03912.68
5.3.190.0080.04412.68
5.3.180.0090.04012.68
5.3.170.0110.03312.67
5.3.160.0060.03712.67
5.3.150.0090.03512.67
5.3.140.0050.03812.66
5.3.130.0070.04012.66
5.3.120.0120.03412.66
5.3.110.0090.04112.65
5.3.100.0100.04812.12
5.3.90.0060.04312.08
5.3.80.0080.03712.07
5.3.70.0070.03912.08
5.3.60.0040.04012.06
5.3.50.0060.03712.00
5.3.40.0070.03512.00
5.3.30.0080.03411.93
5.3.20.0070.04111.70
5.3.10.0090.04011.67
5.3.00.0080.03511.65
5.2.170.0100.0399.15
5.2.160.0070.0369.15
5.2.150.0090.0399.15
5.2.140.0110.0409.15
5.2.130.0060.0439.11
5.2.120.0100.0379.11
5.2.110.0070.0299.12
5.2.100.0070.0319.11
5.2.90.0050.0309.11
5.2.80.0070.0299.11
5.2.70.0060.0309.11
5.2.60.0030.0359.07
5.2.50.0070.0409.04
5.2.40.0050.0319.00
5.2.30.0080.0278.99
5.2.20.0130.0348.98
5.2.10.0070.0268.90
5.2.00.0040.0448.76
5.1.60.0040.0278.04
5.1.50.0060.0248.04
5.1.40.0070.0228.03
5.1.30.0060.0268.38
5.1.20.0050.0268.40
5.1.10.0030.0288.12
5.1.00.0060.0268.13
5.0.50.0050.0276.60
5.0.40.0050.0206.46
5.0.30.0050.0316.27
5.0.20.0060.0246.25
5.0.10.0050.0266.23
5.0.00.0030.0346.21
4.4.90.0030.0164.78
4.4.80.0020.0254.76
4.4.70.0050.0154.75
4.4.60.0080.0194.75
4.4.50.0030.0224.77
4.4.40.0020.0274.71
4.4.30.0050.0194.76
4.4.20.0030.0164.84
4.4.10.0040.0154.85
4.4.00.0070.0284.76
4.3.110.0020.0184.67
4.3.100.0040.0204.66
4.3.90.0070.0194.63
4.3.80.0050.0254.58
4.3.70.0030.0154.63
4.3.60.0040.0144.63
4.3.50.0040.0144.63
4.3.40.0020.0254.54
4.3.30.0030.0153.27
4.3.20.0020.0163.25
4.3.10.0010.0163.22
4.3.00.0030.02015.60

preferences:
31.54 ms | 400 KiB | 5 Q