3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Collection implements Iterator { protected $array, $valid = false; public function __construct(array $a) { echo __METHOD__ . "\n"; $this->array = $a; } public function current() { echo __METHOD__ . "\n"; return current($this->array); } public function key() { echo __METHOD__ . "\n"; return key($this->array); } public function next() { echo __METHOD__ . "\n"; $this->valid = (false !== next($this->array)); } public function valid() { echo __METHOD__ . "\n"; return $this->valid; } public function rewind() { echo __METHOD__ . "\n"; $this->valid = (false !== reset($this->array)); } } class TestFilter extends FilterIterator { public function accept() { echo __METHOD__ . "\n"; throw new Exception("Failure in Accept"); } } $test = new TestFilter(new Collection(array(0))); try { foreach ($test as $item) { echo $item; } } catch (Exception $e) { var_dump($e->getMessage()); } ?> ===DONE===

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.00316.75
8.3.50.0220.01221.99
8.3.40.0150.00318.67
8.3.30.0070.00719.04
8.3.20.0070.00020.29
8.3.10.0000.00821.90
8.3.00.0030.00517.93
8.2.180.0170.00316.63
8.2.170.0150.00322.96
8.2.160.0060.00920.39
8.2.150.0000.00824.18
8.2.140.0080.00024.66
8.2.130.0140.00426.16
8.2.120.0080.00020.78
8.2.110.0090.00020.22
8.2.100.0070.00417.79
8.2.90.0040.00418.16
8.2.80.0080.00017.97
8.2.70.0000.00817.63
8.2.60.0030.00618.03
8.2.50.0030.00518.07
8.2.40.0100.00018.22
8.2.30.0040.00418.10
8.2.20.0050.00317.76
8.2.10.0050.00218.02
8.2.00.0050.00317.69
8.1.280.0040.01125.92
8.1.270.0030.00623.84
8.1.260.0070.00026.35
8.1.250.0080.00028.09
8.1.240.0040.00422.14
8.1.230.0090.00320.92
8.1.220.0040.00417.74
8.1.210.0000.00819.06
8.1.200.0090.00017.35
8.1.190.0000.00817.25
8.1.180.0030.00618.10
8.1.170.0030.00618.49
8.1.160.0040.00422.03
8.1.150.0000.00718.80
8.1.140.0090.00017.40
8.1.130.0030.00317.85
8.1.120.0000.00717.57
8.1.110.0000.00817.51
8.1.100.0040.00417.48
8.1.90.0070.00317.37
8.1.80.0050.00217.46
8.1.70.0000.00717.46
8.1.60.0090.00317.50
8.1.50.0040.00417.52
8.1.40.0080.00017.50
8.1.30.0030.00517.52
8.1.20.0050.00317.69
8.1.10.0000.00717.45
8.1.00.0040.00417.47
8.0.300.0050.00320.02
8.0.290.0040.00416.75
8.0.280.0000.00718.47
8.0.270.0030.00317.27
8.0.260.0000.00617.19
8.0.250.0000.00717.07
8.0.240.0000.00717.03
8.0.230.0000.00717.03
8.0.220.0000.00716.93
8.0.210.0000.00716.94
8.0.200.0030.00317.01
8.0.190.0000.00717.03
8.0.180.0000.00816.98
8.0.170.0040.00416.84
8.0.160.0030.00316.91
8.0.150.0000.00816.92
8.0.140.0030.00616.97
8.0.130.0030.00313.33
8.0.120.0040.00416.89
8.0.110.0080.00016.96
8.0.100.0000.00716.80
8.0.90.0040.00416.84
8.0.80.0060.01216.94
8.0.70.0040.00416.96
8.0.60.0000.00716.95
8.0.50.0040.00416.98
8.0.30.0080.01017.11
8.0.20.0090.01317.40
8.0.10.0040.00417.14
8.0.00.0070.01116.87
7.4.330.0030.00315.00
7.4.320.0030.00316.52
7.4.300.0070.00016.63
7.4.290.0080.00016.56
7.4.280.0000.00716.52
7.4.270.0000.00816.50
7.4.260.0000.01116.49
7.4.250.0050.00316.55
7.4.240.0040.00316.56
7.4.230.0030.00316.73
7.4.220.0090.00916.53
7.4.210.0140.00716.54
7.4.200.0070.00016.49
7.4.160.0120.01216.56
7.4.150.0150.00417.40
7.4.140.0100.00717.86
7.4.130.0100.00916.55
7.4.120.0070.01216.66
7.4.110.0140.01016.41
7.4.100.0070.01416.52
7.4.90.0100.00716.41
7.4.80.0030.01519.39
7.4.70.0110.01116.45
7.4.60.0170.00016.56
7.4.50.0000.00416.42
7.4.40.0100.00716.33
7.4.30.0060.01216.56
7.4.00.0070.01015.00
7.3.330.0000.00513.16
7.3.320.0050.00013.22
7.3.310.0000.00716.26
7.3.300.0030.00316.21
7.3.290.0060.01316.45
7.3.280.0080.01016.35
7.3.270.0000.01817.40
7.3.260.0150.00316.57
7.3.240.0160.00316.29
7.3.230.0040.01416.46
7.3.210.0130.00716.57
7.3.200.0090.00919.39
7.3.190.0030.01416.52
7.3.180.0080.00816.50
7.3.170.0130.00316.58
7.3.160.0100.00616.43
7.3.120.0090.00614.77
7.2.330.0100.01016.73
7.2.320.0120.00416.57
7.2.310.0070.01116.44
7.2.300.0070.01016.72
7.2.290.0060.00916.43
7.1.70.0050.00217.09
7.1.60.0070.01419.11
7.1.50.0110.01116.77
7.1.00.0000.08022.35
7.0.200.0030.00316.79
7.0.140.0070.07021.98
7.0.60.0030.08320.04
7.0.50.0070.08017.97
7.0.40.0030.04320.18
7.0.30.0270.08720.15
7.0.20.0130.04320.12
7.0.10.0100.06720.23
7.0.00.0030.04320.09
5.6.280.0000.07721.13
5.6.210.0030.04020.63
5.6.200.0000.04318.25
5.6.190.0130.08720.64
5.6.180.0170.07020.63
5.6.170.0230.04320.47
5.6.160.0000.04320.45
5.6.150.0070.08018.18
5.6.140.0100.04318.18
5.6.130.0200.07018.14
5.6.120.0000.05321.03
5.6.110.0200.05321.05
5.6.100.0070.08720.96
5.6.90.0100.03320.89
5.6.80.0100.06020.41
5.5.350.0330.07720.50
5.5.340.0030.05017.98
5.5.330.0070.08020.35
5.5.320.0230.04320.34
5.5.310.0200.05020.29
5.5.300.0030.03718.01
5.5.290.0130.05018.08
5.5.280.0070.04320.66
5.5.270.0130.07720.80
5.5.260.0170.06020.88
5.5.250.0030.08320.48
5.5.240.0100.06720.25
5.4.450.0330.04319.55
5.4.440.0100.05019.16
5.4.430.0330.05019.65
5.4.420.0370.03719.16
5.4.410.0270.04719.14
5.4.400.0330.03719.34
5.4.390.0230.04319.09
5.4.380.0370.05018.57
5.4.370.0270.05718.81
5.4.360.0370.04718.73
5.4.350.0370.05318.73
5.4.340.0300.05018.61
5.4.320.0100.04312.51
5.4.310.0060.03712.51
5.4.300.0040.04112.51
5.4.290.0080.04812.51
5.4.280.0090.05012.40
5.4.270.0050.03812.41
5.4.260.0030.04012.41
5.4.250.0050.03812.41
5.4.240.0060.03512.41
5.4.230.0060.03712.39
5.4.220.0050.03812.39
5.4.210.0070.04012.40
5.4.200.0080.03612.40
5.4.190.0030.03912.40
5.4.180.0060.03512.39
5.4.170.0070.03412.41
5.4.160.0070.03712.40
5.4.150.0060.03512.40
5.4.140.0060.03612.08
5.4.130.0100.03812.07
5.4.120.0050.03812.03
5.4.110.0040.04112.02
5.4.100.0060.03712.02
5.4.90.0060.03612.02
5.4.80.0070.03612.02
5.4.70.0080.03112.02
5.4.60.0060.03412.02
5.4.50.0060.03612.02
5.4.40.0080.03112.01
5.4.30.0070.03412.00
5.4.20.0060.03512.00
5.4.10.0080.03212.00
5.4.00.0040.03711.49
5.3.290.0080.04212.80
5.3.280.0090.03412.71
5.3.270.0040.04012.72
5.3.260.0050.03912.72
5.3.250.0040.04012.72
5.3.240.0060.03712.72
5.3.230.0070.03612.71
5.3.220.0060.03712.68
5.3.210.0050.04212.68
5.3.200.0050.03812.68
5.3.190.0080.03512.68
5.3.180.0060.03512.68
5.3.170.0060.03612.67
5.3.160.0040.03812.68
5.3.150.0060.03712.68
5.3.140.0070.03512.66
5.3.130.0040.04112.66
5.3.120.0060.03912.66
5.3.110.0080.03612.66
5.3.100.0010.04212.13
5.3.90.0060.03512.11
5.3.80.0040.03712.11
5.3.70.0080.03312.10
5.3.60.0040.03812.09
5.3.50.0070.03412.04
5.3.40.0070.03512.04
5.3.30.0050.03611.99
5.3.20.0070.03511.78
5.3.10.0050.03611.74
5.3.00.0050.03811.73
5.2.170.0030.0329.23
5.2.160.0070.0269.23
5.2.150.0060.0319.23
5.2.140.0060.0289.23
5.2.130.0060.0279.19
5.2.120.0040.0289.19
5.2.110.0050.0289.20
5.2.100.0060.0339.19
5.2.90.0080.0259.20
5.2.80.0040.0309.19
5.2.70.0030.0319.19
5.2.60.0060.0339.14
5.2.50.0070.0359.11
5.2.40.0050.0379.09
5.2.30.0050.0289.07
5.2.20.0070.0259.05
5.2.10.0040.0288.95
5.2.00.0020.0318.82
5.1.60.0020.0268.11
5.1.50.0070.0298.10
5.1.40.0060.0288.09
5.1.30.0070.0318.44
5.1.20.0040.0298.46
5.1.10.0050.0258.18
5.1.00.0040.0258.18
5.0.50.0040.0276.64
5.0.40.0020.0216.50
5.0.30.0020.0326.32
5.0.20.0020.0216.28
5.0.10.0050.0186.26
5.0.00.0030.0326.25
4.4.90.0040.0144.78
4.4.80.0050.0134.76
4.4.70.0010.0174.75
4.4.60.0030.0154.75
4.4.50.0040.0214.77
4.4.40.0030.0244.71
4.4.30.0030.0154.76
4.4.20.0020.0164.85
4.4.10.0040.0214.85
4.4.00.0010.0304.76
4.3.110.0010.0184.67
4.3.100.0040.0134.67
4.3.90.0030.0224.63
4.3.80.0050.0274.58
4.3.70.0020.0214.63
4.3.60.0020.0154.63
4.3.50.0010.0174.62
4.3.40.0060.0234.54
4.3.30.0010.0173.30
4.3.20.0030.0153.28
4.3.10.0010.0173.23
4.3.00.0030.01715.29

preferences:
45.11 ms | 401 KiB | 5 Q