3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Collection implements IteratorAggregate { public function __construct(array $data) { $this->data = $data; } public function getIterator() { krsort($this->data); return new RecursiveIteratorIterator(new RecursiveArrayIterator($this->data)); } } $c = new Collection([ 10 => ['a', 'b'], 20 => ['c'], ]); var_dump(iterator_to_array($c, false));

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.0090.00918.43
8.3.50.0120.00422.02
8.3.40.0090.00618.88
8.3.30.0110.00419.06
8.3.20.0040.00420.35
8.3.10.0030.00523.48
8.3.00.0080.00020.83
8.2.180.0130.01025.92
8.2.170.0090.00618.92
8.2.160.0070.00722.96
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0080.00020.86
8.2.110.0080.00322.20
8.2.100.0000.01117.89
8.2.90.0090.00018.16
8.2.80.0000.00820.36
8.2.70.0030.00617.50
8.2.60.0030.00518.03
8.2.50.0000.00818.07
8.2.40.0030.00619.95
8.2.30.0040.00418.29
8.2.20.0020.00517.66
8.2.10.0050.00217.93
8.2.00.0080.00017.81
8.1.280.0140.00725.92
8.1.270.0050.00322.13
8.1.260.0040.00428.09
8.1.250.0070.00028.09
8.1.240.0090.00023.88
8.1.230.0070.00420.88
8.1.220.0040.00417.74
8.1.210.0030.00618.77
8.1.200.0070.00317.35
8.1.190.0040.00417.23
8.1.180.0040.00418.10
8.1.170.0090.00018.57
8.1.160.0040.00422.03
8.1.150.0050.00218.70
8.1.140.0000.00717.41
8.1.130.0030.00317.79
8.1.120.0000.00717.49
8.1.110.0000.00717.40
8.1.100.0040.00417.50
8.1.90.0030.00617.50
8.1.80.0050.00217.52
8.1.70.0040.00417.39
8.1.60.0000.01117.48
8.1.50.0080.00017.51
8.1.40.0040.00417.39
8.1.30.0040.00417.62
8.1.20.0030.00517.64
8.1.10.0000.00717.59
8.1.00.0030.00617.43
8.0.300.0050.00320.04
8.0.290.0070.00017.18
8.0.280.0070.00018.36
8.0.270.0080.00017.30
8.0.260.0000.00617.21
8.0.250.0000.00717.02
8.0.240.0070.00016.85
8.0.230.0040.00416.87
8.0.220.0030.00316.78
8.0.210.0060.00016.89
8.0.200.0000.00616.97
8.0.190.0040.00416.98
8.0.180.0030.00316.82
8.0.170.0000.00716.91
8.0.160.0030.00316.85
8.0.150.0040.00416.96
8.0.140.0030.00316.81
8.0.130.0050.00013.31
8.0.120.0000.00716.84
8.0.110.0000.00716.86
8.0.100.0000.00716.76
8.0.90.0070.00016.70
8.0.80.0040.01116.82
8.0.70.0050.00316.95
8.0.60.0050.00216.75
8.0.50.0000.00716.70
8.0.30.0140.00816.99
8.0.20.0220.01517.40
8.0.10.0040.00416.98
8.0.00.0110.00816.85
7.4.330.0030.00315.00
7.4.320.0000.00716.56
7.4.300.0000.00716.46
7.4.290.0040.00416.50
7.4.280.0050.00316.62
7.4.270.0050.00216.53
7.4.260.0030.00316.49
7.4.250.0080.00016.57
7.4.240.0020.00616.51
7.4.230.0000.00716.68
7.4.220.0040.01116.61
7.4.210.0070.00716.71
7.4.200.0000.00716.49
7.4.160.0170.00016.37
7.4.150.0120.00617.40
7.4.140.0110.00817.86
7.4.130.0100.00616.52
7.4.120.0080.00916.49
7.4.110.0070.01016.52
7.4.100.0150.00316.62
7.4.90.0030.01516.47
7.4.80.0080.01619.39
7.4.70.0030.01316.38
7.4.60.0100.01016.39
7.4.50.0000.00416.38
7.4.40.0060.01116.61
7.4.30.0120.00416.51
7.4.00.0100.00315.19
7.3.330.0000.00612.99
7.3.320.0020.00213.19
7.3.310.0070.00016.39
7.3.300.0000.00716.22
7.3.290.0090.00616.33
7.3.280.0100.01016.25
7.3.270.0130.00417.40
7.3.260.0120.00616.37
7.3.250.0110.01316.48
7.3.240.0060.01116.39
7.3.230.0100.00616.44
7.3.210.0170.00316.45
7.3.200.0130.00619.39
7.3.190.0080.00816.23
7.3.180.0080.00916.41
7.3.170.0060.00916.56
7.3.160.0060.00916.39
7.3.120.0070.00714.83
7.2.330.0130.01016.77
7.2.320.0090.00916.68
7.2.310.0150.00616.40
7.2.300.0120.00516.50
7.2.290.0160.00416.50
7.2.60.0100.00317.09
7.2.00.0040.01219.43
7.1.200.0000.01315.80
7.1.100.0030.01017.94
7.1.70.0030.00317.23
7.1.60.0060.01919.70
7.1.50.0130.01017.04
7.1.00.0000.08022.41
7.0.200.0090.00616.66
7.0.140.0100.06722.04
7.0.60.0030.05020.02
7.0.50.0070.03717.95
7.0.40.0070.06720.21
7.0.30.0230.06720.17
7.0.20.0170.04020.25
7.0.10.0130.08020.20
7.0.00.0030.04320.22
5.6.280.0000.07320.91
5.6.210.0130.06320.76
5.6.200.0070.04318.19
5.6.190.0030.06320.55
5.6.180.3630.03720.55
5.6.170.0230.06720.44
5.6.160.0130.08020.39
5.6.150.0130.07718.12
5.6.140.0070.08018.27
5.6.130.0170.05018.24
5.6.120.0070.03720.94
5.6.110.0070.03720.99
5.6.100.0000.04721.01
5.6.90.0100.06320.96
5.6.80.0070.08320.51
5.5.350.0270.07720.32
5.5.340.0030.04017.99
5.5.330.0170.05020.40
5.5.320.0400.06320.51
5.5.310.0170.03720.20
5.5.300.0070.05717.99
5.5.290.0130.05017.96
5.5.280.0070.07020.66
5.5.270.0100.08720.86
5.5.260.0200.06020.65
5.5.250.0030.04020.55
5.5.240.0130.04020.16
5.4.450.0230.04026.13
5.4.440.0270.04726.12
5.4.430.0170.04726.10
5.4.420.0230.04026.09
5.4.410.0300.04326.08
5.4.400.0400.03325.91
5.4.390.0300.05325.73
5.4.380.0100.05718.74
5.4.370.0030.06018.75
5.4.360.0130.05318.74
5.4.350.0130.05318.79
5.4.340.0100.05718.59
5.4.320.0050.03712.51
5.4.310.0080.03612.50
5.4.300.0080.04812.51
5.4.290.0060.05212.50
5.4.280.0060.05012.40
5.4.270.0060.04812.40
5.4.260.0120.04412.40
5.4.250.0090.05212.40
5.4.240.0050.05612.40
5.4.230.0100.05012.39
5.4.220.0110.04812.39
5.4.210.0080.05212.39
5.4.200.0080.05112.39
5.4.190.0100.04512.38
5.4.180.0080.03712.39
5.4.170.0080.04312.40
5.4.160.0070.03612.40
5.4.150.0100.04212.39
5.4.140.0050.05212.07
5.4.130.0030.05212.06
5.4.120.0070.05112.02
5.4.110.0070.04812.02
5.4.100.0040.03912.02
5.4.90.0080.05112.02
5.4.80.0100.04912.02
5.4.70.0090.04812.01
5.4.60.0050.05312.01
5.4.50.0060.05212.02
5.4.40.0070.05112.00
5.4.30.0100.04612.00
5.4.20.0100.04812.00
5.4.10.0090.04912.00
5.4.00.0090.04911.48
5.3.290.0060.04112.80
5.3.280.0100.05012.71
5.3.270.0150.04812.73
5.3.260.0110.05212.71
5.3.250.0120.04912.72
5.3.240.0130.04912.72
5.3.230.0060.05412.71
5.3.220.0090.05412.68
5.3.210.0060.05712.68
5.3.200.0100.05112.68
5.3.190.0070.05412.68
5.3.180.0130.04812.68
5.3.170.0080.05312.67
5.3.160.0090.05212.68
5.3.150.0080.05312.68
5.3.140.0100.04712.66
5.3.130.0100.03612.66
5.3.120.0090.03912.66
5.3.110.0060.04212.66
5.3.100.0070.04112.13
5.3.90.0060.04212.11
5.3.80.0060.04012.10
5.3.70.0060.04212.10
5.3.60.0070.04512.08
5.3.50.0140.03712.03
5.3.40.0070.04312.03
5.3.30.0100.04011.99
5.3.20.0160.03711.77
5.3.10.0110.03311.74
5.3.00.0080.03811.72
5.2.170.0060.0379.23
5.2.160.0050.0449.23
5.2.150.0060.0459.23
5.2.140.0040.0479.22
5.2.130.0080.0419.18
5.2.120.0090.0389.18
5.2.110.0100.0299.19
5.2.100.0080.0359.18
5.2.90.0050.0449.19
5.2.80.0080.0409.18
5.2.70.0110.0389.18
5.2.60.0050.0439.13
5.2.50.0070.0419.11
5.2.40.0050.0409.08
5.2.30.0060.0429.06
5.2.20.0100.0359.05
5.2.10.0040.0408.95
5.2.00.0080.0398.82
5.1.60.0080.0328.10
5.1.50.0050.0458.09
5.1.40.0070.0348.07
5.1.30.0050.0418.42
5.1.20.0100.0418.45
5.1.10.0090.0428.17
5.1.00.0060.0378.17
5.0.50.0050.0286.64
5.0.40.0040.0286.50
5.0.30.0020.0446.31
5.0.20.0050.0266.28
5.0.10.0030.0296.26
5.0.00.0020.0426.25
4.4.90.0030.0264.78
4.4.80.0040.0224.75
4.4.70.0030.0224.75
4.4.60.0040.0234.75
4.4.50.0070.0234.77
4.4.40.0070.0334.71
4.4.30.0030.0224.76
4.4.20.0020.0244.84
4.4.10.0040.0224.85
4.4.00.0070.0294.76
4.3.110.0040.0224.67
4.3.100.0040.0214.66
4.3.90.0040.0214.63
4.3.80.0050.0304.58
4.3.70.0010.0244.63
4.3.60.0050.0194.63
4.3.50.0060.0204.63
4.3.40.0020.0344.54
4.3.30.0050.0193.30
4.3.20.0000.0243.28
4.3.10.0020.0223.23
4.3.00.0070.01725.72

preferences:
39.1 ms | 401 KiB | 5 Q