3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Derp implements Iterator { protected $index; protected $array; public function __construct(array $input) { $this->array = $input; } public function current() { return $this->array[$this->index]; } public function next() { $this->index += 1; } public function key() { return $this->index; } public function valid() { return isset($this->array[$this->index]); } public function rewind() { $this->index = 0; } } $d = new Derp(range(1,100)); echo is_array($d) ? 'It\'s an array!' : 'Not an array'; foreach($d as $key => $value) { echo "$key => $value\n"; }

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.40.0110.00418.76
8.3.30.0120.00318.76
8.3.20.0040.00418.95
8.3.10.0090.00020.55
8.3.00.0030.00619.51
8.2.170.0120.00622.96
8.2.160.0090.00620.96
8.2.150.0080.00024.18
8.2.140.0120.00624.66
8.2.130.0040.00426.16
8.2.120.0080.00020.91
8.2.110.0100.00020.38
8.2.100.0000.01217.85
8.2.90.0030.00618.22
8.2.80.0020.00519.21
8.2.70.0080.00017.50
8.2.60.0040.00417.93
8.2.50.0000.00818.07
8.2.40.0040.00418.16
8.2.30.0060.00318.00
8.2.20.0040.00417.72
8.2.10.0050.00317.66
8.2.00.0000.00817.61
8.1.270.0080.00024.66
8.1.260.0000.00826.35
8.1.250.0030.00528.09
8.1.240.0040.00422.14
8.1.230.0000.01121.09
8.1.220.0040.00417.76
8.1.210.0090.00019.04
8.1.200.0030.00717.35
8.1.190.0030.00517.66
8.1.180.0030.00618.10
8.1.170.0050.00318.91
8.1.160.0070.00018.94
8.1.150.0040.00418.58
8.1.140.0080.00017.51
8.1.130.0030.00617.71
8.1.120.0000.00717.34
8.1.110.0040.00417.36
8.1.100.0000.00717.41
8.1.90.0000.00717.52
8.1.80.0000.00717.38
8.1.70.0040.00417.43
8.1.60.0030.00617.61
8.1.50.0030.00517.48
8.1.40.0040.00417.49
8.1.30.0080.00017.57
8.1.20.0000.00817.65
8.1.10.0040.00417.48
8.1.00.0000.00817.50
8.0.300.0050.00220.02
8.0.290.0040.00416.63
8.0.280.0030.00518.36
8.0.270.0050.00217.34
8.0.260.0030.00316.84
8.0.250.0060.00316.98
8.0.240.0080.00016.98
8.0.230.0020.00516.99
8.0.220.0000.00716.82
8.0.210.0030.00316.80
8.0.200.0070.00016.99
8.0.190.0040.00317.00
8.0.180.0040.00416.89
8.0.170.0030.00616.90
8.0.160.0050.00316.85
8.0.150.0050.00516.76
8.0.140.0080.00016.89
8.0.130.0040.00413.29
8.0.120.0040.00416.77
8.0.110.0000.00816.75
8.0.100.0000.00716.79
8.0.90.0040.00416.77
8.0.80.0120.00316.89
8.0.70.0050.00216.93
8.0.60.0040.00416.68
8.0.50.0040.00416.73
8.0.30.0110.00717.15
8.0.20.0120.01117.19
8.0.10.0030.00517.08
8.0.00.0130.00616.95
7.4.330.0000.00513.05
7.4.320.0000.00616.63
7.4.300.0000.00716.60
7.4.290.0000.00716.51
7.4.280.0000.01016.60
7.4.270.0040.00416.52
7.4.260.0060.00013.20
7.4.250.0080.00016.43
7.4.240.0030.00616.62
7.4.230.0000.00716.68
7.4.220.0090.01316.50
7.4.210.0100.00616.61
7.4.200.0070.00016.51
7.4.190.0030.00316.64
7.4.160.0160.00016.46
7.4.150.0050.01316.55
7.4.140.0120.00716.53
7.4.130.0110.00716.60
7.4.120.0090.00916.49
7.4.110.0140.00616.41
7.4.100.0090.01516.57
7.4.90.0120.00616.47
7.4.80.0190.00619.39
7.4.70.0090.01316.44
7.4.60.0060.01616.60
7.4.50.0090.00416.68
7.4.40.0100.00716.45
7.4.30.0090.00916.47
7.4.00.0090.00615.16
7.3.330.0000.00713.34
7.3.320.0000.00613.15
7.3.310.0070.00016.37
7.3.300.0030.00316.32
7.3.290.0140.00416.41
7.3.280.0070.00916.40
7.3.270.0080.01116.50
7.3.260.0000.01816.53
7.3.250.0110.01116.45
7.3.240.0150.00616.34
7.3.230.0070.01016.54
7.3.210.0160.00316.58
7.3.200.0100.01316.55
7.3.190.0090.01116.28
7.3.180.0040.01216.67
7.3.170.0050.01016.36
7.3.160.0090.00616.39
7.3.120.0090.00614.87
7.2.330.0070.01716.81
7.2.320.0110.00716.68
7.2.310.0130.01416.83
7.2.300.0080.00716.52
7.2.290.0070.01016.81
7.2.00.0030.00919.37
7.1.200.0090.00315.89
7.1.70.0000.01117.14
7.1.60.0070.01419.40
7.1.50.0000.01016.91
7.1.00.0000.03722.45
7.0.200.0030.00616.47
7.0.140.0070.07322.04
7.0.120.0000.07322.13
7.0.60.0030.07019.94
7.0.50.0070.08717.88
7.0.40.0070.05317.71
7.0.30.0030.04317.82
7.0.20.0100.06017.86
7.0.10.0070.08017.78
7.0.00.0070.08317.80
5.6.280.0030.07321.02
5.6.210.0070.08320.75
5.6.200.0130.08018.29
5.6.190.0070.06018.15
5.6.180.0070.04718.14
5.6.170.0070.08318.21
5.6.160.0030.07718.14
5.6.150.0070.08318.27
5.6.140.0070.06018.15
5.6.130.0070.07718.15
5.6.120.0100.04718.18
5.6.110.0130.08018.28
5.6.100.0070.07718.20
5.6.90.0100.07018.12
5.6.80.0130.07017.57
5.6.70.0030.07017.55
5.6.60.0000.06317.60
5.6.50.0070.07317.62
5.6.40.0030.08017.54
5.6.30.0030.06017.64
5.6.20.0070.06317.54
5.6.10.0070.07717.50
5.6.00.0070.05317.55
5.5.350.0270.07020.34
5.5.340.0070.08318.02
5.5.330.0070.08017.95
5.5.320.0070.04017.94
5.5.310.0070.06317.92
5.5.300.0000.05017.98
5.5.290.0070.05318.06
5.5.280.0170.07017.97
5.5.270.0100.06017.92
5.5.260.0000.08718.07
5.5.250.0030.08317.77
5.5.240.0070.04317.43
5.5.230.0070.05017.36
5.5.220.0070.08017.32
5.5.210.0100.03717.37
5.5.200.0070.05717.34
5.5.190.0100.04317.36
5.5.180.0030.06317.34
5.5.160.0100.06317.39
5.5.150.0070.06017.29
5.5.140.0070.07317.38
5.5.130.0030.05317.34
5.5.120.0070.07317.33
5.5.110.0100.07717.43
5.5.100.0070.04317.34
5.5.90.0030.07317.28
5.5.80.0100.07017.23
5.5.70.0100.07317.21
5.5.60.0100.04317.18
5.5.50.0100.04317.18
5.5.40.0070.04317.20
5.5.30.0030.03717.32
5.5.20.0030.04317.17
5.5.10.0070.04317.19
5.5.00.0070.03317.25
5.4.450.0100.07319.61
5.4.440.0100.06019.47
5.4.430.0170.06319.60
5.4.420.0100.07719.61
5.4.410.0170.03719.31
5.4.400.0000.08019.04
5.4.390.0130.05319.03
5.4.380.0130.06719.03
5.4.370.0100.07719.17
5.4.360.0000.05019.00
5.4.350.0070.04719.05
5.4.340.0130.05319.02
5.4.320.0100.06019.09
5.4.310.0100.07719.02
5.4.300.0100.07318.98
5.4.290.0170.05319.03
5.4.280.0100.08019.11
5.4.270.0030.06719.09
5.4.260.0000.05019.03
5.4.250.0070.08019.03
5.4.240.0100.05719.01
5.4.230.0130.07019.08
5.4.220.0030.04019.04
5.4.210.0100.07018.95
5.4.200.0030.05019.26
5.4.190.0100.06319.02
5.4.180.0030.04718.97
5.4.170.0070.03319.04
5.4.160.0030.03718.93
5.4.150.0000.04319.00
5.4.140.0000.04016.37
5.4.130.0030.03316.30
5.4.120.0000.04016.59
5.4.110.0000.03716.35
5.4.100.0130.03316.48
5.4.90.0000.03716.46
5.4.80.0000.03716.37
5.4.70.0030.03316.54
5.4.60.0030.03316.41
5.4.50.0000.03716.37
5.4.40.0000.03716.44
5.4.30.0100.02716.42
5.4.20.0030.03316.38
5.4.10.0070.03316.36
5.4.00.0070.03015.88
5.3.290.0000.06314.63
5.3.280.0030.05714.61
5.3.270.0030.03714.47
5.3.260.0070.03314.64
5.3.250.0000.04014.83
5.3.240.0000.04014.63
5.3.230.0000.04014.63
5.3.220.0070.03314.56
5.3.210.0070.03714.62
5.3.200.0070.03714.53
5.3.190.0000.04014.57
5.3.180.0130.02714.63
5.3.170.0000.03714.61
5.3.160.0100.02714.64
5.3.150.0030.03314.54
5.3.140.0030.03714.52
5.3.130.0000.04014.52
5.3.120.0070.03714.60
5.3.110.0070.03314.63
5.3.100.0070.03314.00
5.3.90.0070.03014.04
5.3.80.0030.03714.24
5.3.70.0030.03714.09
5.3.60.0000.04713.90
5.3.50.0000.03713.95
5.3.40.0030.03714.05
5.3.30.0030.03713.82
5.3.20.0030.03313.77
5.3.10.0030.03313.70
5.3.00.0030.03313.67
5.2.170.0070.02311.05
5.2.160.0030.02711.18
5.2.150.0000.03011.20
5.2.140.0000.03011.15
5.2.130.0030.03311.16
5.2.120.0030.03011.13
5.2.110.0070.02311.18
5.2.100.0000.03311.13
5.2.90.0000.03011.18
5.2.80.0000.03711.11
5.2.70.0070.03711.11
5.2.60.0070.03311.06
5.2.50.0000.03011.07
5.2.40.0030.02711.06
5.2.30.0070.05010.88
5.2.20.0070.06010.97
5.2.10.0030.03310.94
5.2.00.0070.04310.83
5.1.60.0100.03310.22
5.1.50.0030.0309.99
5.1.40.0030.0339.83
5.1.30.0030.04710.36
5.1.20.0070.03010.42
5.1.10.0030.05310.15
5.1.00.0030.05710.07
5.0.50.0130.0408.62
5.0.40.0130.0308.39
5.0.30.0070.0638.19
5.0.20.0030.0308.10
5.0.10.0030.0378.00
5.0.00.0030.0708.21
4.4.90.0000.0377.93
4.4.80.0000.0377.93
4.4.70.0000.0407.93
4.4.60.0000.0277.93
4.4.50.0070.0177.93
4.4.40.0030.0537.93
4.4.30.0100.0277.93
4.4.20.0000.0237.93
4.4.10.0070.0307.93
4.4.00.0000.0337.93
4.3.110.0070.0337.93
4.3.100.0000.0337.93
4.3.90.0030.0337.93
4.3.80.0000.0477.93
4.3.70.0030.0277.93
4.3.60.0030.0337.93
4.3.50.0000.0337.93
4.3.40.0000.0537.93
4.3.30.0030.0277.93
4.3.20.0030.0377.93
4.3.10.0030.0377.93
4.3.00.0000.0307.93

preferences:
47.3 ms | 400 KiB | 5 Q