3v4l.org

run code in 300+ PHP versions simultaneously
iterator_apply($recursive_array_iterator, 'traverseRecursiveArray', array($recursive_array_iterator)); <?php $myArray = new ArrayObject( "a", new ArrayObject( "a", "b", new ArrayObject( "a", "b", "c", new ArrayObject( "a", "b", "c", "d", new ArrayObject("the end") ) ) ) ); $recursive_array_iterator = new RecursiveArrayIterator($myArray); iterator_apply($recursive_array_iterator, 'traverseRecursiveArray', array($recursive_array_iterator)); function traverseRecursiveArray($iterator) { $i = 0; while ($iterator->valid()) { if ($iterator->hasChildren()) { traverseRecursiveArray($iterator->getChildren()); } else { $iterator->offsetSet($iterator->key(), manipulate($iterator->current())); echo $iterator->key() . ' => ' . $iterator->current() . PHP_EOL; } $iterator->next(); } } function manipulate($string) { $string .= " appended"; return $string; } var_dump($myArray);

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.0080.00816.50
8.3.50.0150.00521.99
8.3.40.0110.00418.87
8.3.30.0030.01319.27
8.3.20.0040.00420.34
8.3.10.0080.00021.76
8.3.00.0040.00417.66
8.2.180.0120.00616.88
8.2.170.0090.00622.96
8.2.160.0070.00720.36
8.2.150.0040.00424.18
8.2.140.0060.00324.66
8.2.130.0000.00826.16
8.2.120.0070.00019.54
8.2.110.0030.00621.00
8.2.100.0070.00717.78
8.2.90.0080.00019.11
8.2.80.0040.00417.97
8.2.70.0040.00417.63
8.2.60.0000.00818.04
8.2.50.0030.00618.10
8.2.40.0040.00419.69
8.2.30.0040.00418.12
8.2.20.0070.00017.63
8.2.10.0000.00918.08
8.2.00.0050.00317.76
8.1.280.0100.01025.92
8.1.270.0030.00523.97
8.1.260.0050.00326.35
8.1.250.0050.00328.09
8.1.240.0070.00322.81
8.1.230.0100.00017.77
8.1.220.0030.00617.74
8.1.210.0060.00318.77
8.1.200.0060.00317.35
8.1.190.0040.00417.23
8.1.180.0030.00618.10
8.1.170.0030.00518.52
8.1.160.0000.00721.91
8.1.150.0050.00218.73
8.1.140.0000.00717.30
8.1.130.0030.00317.70
8.1.120.0050.00217.44
8.1.110.0100.00017.33
8.1.100.0040.00317.27
8.1.90.0030.00317.38
8.1.80.0030.00417.38
8.1.70.0030.00317.36
8.1.60.0040.00417.49
8.1.50.0030.00517.38
8.1.40.0020.00517.41
8.1.30.0060.00317.66
8.1.20.0040.00417.50
8.1.10.0000.00817.53
8.1.00.0000.00717.39
8.0.300.0040.00418.77
8.0.290.0030.00516.75
8.0.280.0070.00018.53
8.0.270.0040.00417.16
8.0.260.0030.00317.30
8.0.250.0000.00716.92
8.0.240.0030.00317.03
8.0.230.0030.00316.91
8.0.220.0060.00016.94
8.0.210.0030.00516.80
8.0.200.0050.00217.00
8.0.190.0000.00716.88
8.0.180.0040.00416.96
8.0.170.0050.00216.98
8.0.160.0070.00016.87
8.0.150.0040.00416.77
8.0.140.0000.00816.90
8.0.130.0000.00613.30
8.0.120.0080.00016.88
8.0.110.0000.00716.96
8.0.100.0050.00316.87
8.0.90.0030.00516.95
8.0.80.0070.00716.91
8.0.70.0000.00716.94
8.0.60.0040.00416.91
8.0.50.0040.00416.81
8.0.30.0110.01217.01
8.0.20.0120.00817.40
8.0.10.0040.00417.00
8.0.00.0070.01216.77
7.4.330.0050.00015.00
7.4.320.0060.00016.39
7.4.300.0060.00016.59
7.4.290.0000.00716.47
7.4.280.0070.00016.54
7.4.270.0030.00316.48
7.4.260.0080.00016.44
7.4.250.0040.00416.52
7.4.240.0010.00616.53
7.4.230.0050.00316.22
7.4.220.0090.00916.64
7.4.210.0100.01316.52
7.4.200.0030.00316.58
7.4.160.0060.00916.59
7.4.150.0100.00717.40
7.4.140.0120.00517.86
7.4.130.0110.00616.37
7.4.120.0080.00916.59
7.4.110.0060.01616.45
7.4.100.0080.00816.42
7.4.90.0170.00016.36
7.4.80.0100.01319.39
7.4.70.0110.00616.75
7.4.60.0060.01416.38
7.4.50.0060.00316.30
7.4.40.0080.00816.55
7.4.30.0140.00316.45
7.4.10.0090.00915.10
7.4.00.0050.01314.70
7.3.330.0020.00213.16
7.3.320.0000.00513.32
7.3.310.0000.00716.38
7.3.300.0040.00416.20
7.3.290.0070.01416.32
7.3.280.0120.00616.36
7.3.270.0110.00617.40
7.3.260.0070.01716.54
7.3.250.0050.01216.56
7.3.240.0060.01216.49
7.3.230.0160.00316.57
7.3.210.0120.00416.43
7.3.200.0040.01719.39
7.3.190.0090.01216.55
7.3.180.0160.00016.35
7.3.170.0060.01616.47
7.3.160.0090.00616.44
7.3.130.0070.01014.88
7.3.120.0100.00814.76
7.3.110.0070.01014.71
7.3.100.0060.00914.84
7.3.90.0110.00714.84
7.3.80.0080.00814.87
7.3.70.0040.00414.87
7.3.60.0030.00914.73
7.3.50.0070.00314.60
7.3.40.0070.01014.64
7.3.30.0000.01614.77
7.3.20.0040.01116.66
7.3.10.0020.01016.50
7.3.00.0040.00916.52
7.2.330.0040.01416.63
7.2.320.0000.01716.37
7.2.310.0130.01016.61
7.2.300.0070.01016.58
7.2.290.0030.01316.42
7.2.260.0070.01115.02
7.2.250.0110.00715.12
7.2.240.0040.01114.88
7.2.230.0030.01314.79
7.2.220.0030.00815.02
7.2.210.0030.01015.13
7.2.200.0060.00614.93
7.2.190.0030.01014.99
7.2.180.0060.00615.11
7.2.170.0060.00614.95
7.2.160.0060.01215.11
7.2.150.0090.00616.86
7.2.140.0070.01016.69
7.2.130.0060.00816.69
7.2.120.0020.01216.77
7.2.110.0060.00916.68
7.2.100.0050.01016.83
7.2.90.0040.01116.89
7.2.80.0050.01116.73
7.2.70.0080.00616.67
7.2.60.0080.00516.77
7.2.50.0080.00616.94
7.2.40.0070.00716.86
7.2.30.0050.01216.83
7.2.20.0050.01116.83
7.2.10.0030.00916.71
7.2.00.0020.01117.52
7.1.330.0130.00315.36
7.1.320.0100.00015.60
7.1.310.0070.00715.67
7.1.300.0060.00315.56
7.1.290.0090.00615.77
7.1.280.0120.00415.66
7.1.270.0030.00715.73
7.1.260.0070.00715.65
7.1.250.0050.00915.63
7.1.240.0000.01815.47
7.1.230.0030.00815.42
7.1.220.0060.00915.71
7.1.210.0100.00015.53
7.1.200.0090.00515.56
7.1.190.0000.01315.59
7.1.180.0060.00615.35
7.1.170.0110.00415.52
7.1.160.0000.01015.82
7.1.150.0120.00315.58
7.1.140.0060.00915.64
7.1.130.0060.00915.76
7.1.120.0070.00715.66
7.1.110.0120.00615.73
7.1.100.0020.01316.77
7.1.90.0070.01015.75
7.1.80.0060.00315.86
7.1.70.0080.00516.28
7.1.60.0100.01017.65
7.1.50.0090.00916.04
7.1.40.0090.00615.82
7.1.30.0070.00715.58
7.1.20.0060.00815.36
7.1.10.0070.00715.60
7.1.00.0050.03919.03
7.0.330.0040.00715.13
7.0.320.0040.00415.25
7.0.310.0000.01415.02
7.0.300.0100.00315.51
7.0.290.0060.00615.06
7.0.280.0040.01115.29
7.0.270.0090.00615.43
7.0.260.0090.00615.33
7.0.250.0030.01315.45
7.0.240.0040.01215.17
7.0.230.0030.01015.49
7.0.220.0000.01215.16
7.0.210.0040.00815.41
7.0.200.0090.00615.98
7.0.190.0050.00915.13
7.0.180.0110.00415.40
7.0.170.0000.01115.33
7.0.160.0080.00815.38
7.0.150.0090.00615.40
7.0.140.0070.04018.69
7.0.130.0000.01415.53
7.0.120.0030.01015.47
7.0.110.0040.01115.42
7.0.100.0120.00314.98
7.0.90.0060.00915.39
7.0.80.0080.00615.05
7.0.70.0100.00315.29
7.0.60.0050.04517.69
7.0.50.0060.03816.61
7.0.40.0010.02916.69
7.0.30.0120.02716.76
7.0.20.0270.03716.68
7.0.10.0050.03116.82
7.0.00.0070.02816.91
5.6.400.0060.00613.80
5.6.390.0060.00614.44
5.6.380.0060.00314.21
5.6.370.0070.00714.23
5.6.360.0110.00414.22
5.6.350.0000.01414.05
5.6.340.0110.00414.37
5.6.330.0000.01414.43
5.6.320.0060.01214.19
5.6.310.0070.00714.28
5.6.300.0060.00814.19
5.6.290.0080.00614.41
5.6.280.0100.03617.59
5.6.270.0000.01414.20
5.6.260.0070.01014.24
5.6.250.0070.00714.10
5.6.240.0070.00714.41
5.6.230.0000.00914.21
5.6.220.0070.00414.19
5.6.210.0110.03317.25
5.6.200.0060.02116.11
5.6.190.0100.04517.38
5.6.180.0110.02817.45
5.6.170.0130.04617.24
5.6.160.0100.02917.25
5.6.150.0030.02316.39
5.6.140.0070.03216.18
5.6.130.0060.02816.21
5.6.120.0120.04117.56
5.6.110.0090.04317.51
5.6.100.0050.02517.68
5.6.90.0080.04517.59
5.6.80.0000.02917.29
5.6.70.0070.00714.00
5.6.60.0090.00613.93
5.6.50.0080.01213.98
5.6.40.0030.00713.93
5.6.30.0090.00614.20
5.6.20.0030.00914.13
5.6.10.0040.01114.46
5.6.00.0070.01114.20
5.5.380.0040.00713.80
5.5.370.0100.00614.41
5.5.360.0070.00713.72
5.5.350.0160.04317.13
5.5.340.0060.02615.98
5.5.330.0080.02417.23
5.5.320.0190.04417.08
5.5.310.0230.03917.24
5.5.300.0020.03216.00
5.5.290.0040.04415.88
5.5.280.0100.03217.51
5.5.270.0080.02117.51
5.5.260.0120.04017.33
5.5.250.0090.03117.38
5.5.240.0050.04417.06
5.5.230.0060.00614.29
5.5.220.0070.00714.20
5.5.210.0030.01014.25
5.5.200.0080.00414.00
5.5.190.0110.00014.16
5.5.180.0040.01014.14
5.5.170.0130.00614.05
5.5.160.0110.00713.95
5.5.150.0000.01014.32
5.5.140.0000.01614.01
5.5.130.0060.00614.22
5.5.120.0090.00014.05
5.5.110.0090.00014.36
5.5.100.0030.00914.22
5.5.90.0070.00414.23
5.5.80.0090.00914.13
5.5.70.0100.00713.98
5.5.60.0060.00614.12
5.5.50.0080.00814.05
5.5.40.0030.01414.37
5.5.30.0030.01414.20
5.5.20.0040.01114.04
5.5.10.0090.00614.19
5.5.00.0000.01513.85
5.4.450.0360.03115.66
5.4.440.0180.02615.57
5.4.430.0130.02815.73
5.4.420.0100.03115.66
5.4.410.0120.02715.47
5.4.400.0150.02715.41
5.4.390.0180.02815.29
5.4.380.0060.03015.38
5.4.370.0060.02015.28
5.4.360.0050.02315.36
5.4.350.0050.02512.00
5.4.340.0090.01912.00
5.4.330.0060.00311.98
5.4.320.0070.02512.25
5.4.310.0050.02212.24
5.4.300.0050.02312.24
5.4.290.0030.02512.24
5.4.280.0030.02412.19
5.4.270.0040.02312.19
5.4.260.0040.02112.19
5.4.250.0030.02412.19
5.4.240.0070.02312.19
5.4.230.0060.02312.19
5.4.220.0050.02312.19
5.4.210.0040.02112.19
5.4.200.0060.02212.19
5.4.190.0080.02212.18
5.4.180.0040.02412.19
5.4.170.0090.01912.19
5.4.160.0050.02112.19
5.4.150.0020.02412.19
5.4.140.0040.02512.03
5.4.130.0050.02212.02
5.4.120.0030.02112.00
5.4.110.0050.01912.00
5.4.100.0020.02512.00
5.4.90.0070.02012.00
5.4.80.0050.02112.00
5.4.70.0070.02012.00
5.4.60.0040.02312.00
5.4.50.0060.02212.00
5.4.40.0020.02211.99
5.4.30.0050.02211.99
5.4.20.0060.02111.99
5.4.10.0060.01911.99
5.4.00.0080.02111.73
5.3.290.0060.02812.39
5.3.280.0040.02512.34
5.3.270.0080.02012.35
5.3.260.0020.02512.35
5.3.250.0070.02112.35
5.3.240.0050.02212.35
5.3.230.0020.02512.35
5.3.220.0050.02312.33
5.3.210.0030.02412.33
5.3.200.0040.02312.33
5.3.190.0060.02412.33
5.3.180.0100.01812.33
5.3.170.0040.02612.32
5.3.160.0040.02512.33
5.3.150.0090.01812.33
5.3.140.0020.02412.32
5.3.130.0070.02412.32
5.3.120.0060.02312.32
5.3.110.0050.02512.32
5.3.100.0050.02312.06
5.3.90.0020.02612.05
5.3.80.0080.01912.04
5.3.70.0040.02312.04
5.3.60.0040.02312.04
5.3.50.0050.02212.01
5.3.40.0060.02212.01
5.3.30.0050.02011.99
5.3.20.0060.02011.88
5.3.10.0040.02011.86
5.3.00.0020.02611.86
5.2.170.0070.0289.23
5.2.160.0070.0279.24
5.2.150.0030.0339.23
5.2.140.0060.0359.23
5.2.130.0080.0269.20
5.2.120.0020.0319.19
5.2.110.0040.0299.20
5.2.100.0030.0319.19
5.2.90.0050.0309.20
5.2.80.0040.0329.19
5.2.70.0060.0339.19
5.2.60.0040.0329.15
5.2.50.0030.0339.12
5.2.40.0040.0309.09
5.2.30.0050.0309.06
5.2.20.0030.0319.05
5.2.10.0040.0288.96
5.2.00.0080.0378.82
5.1.60.0060.0258.11
5.1.50.0080.0258.11
5.1.40.0060.0238.10
5.1.30.0010.0318.44
5.1.20.0060.0378.46
5.1.10.0080.0238.18
5.1.00.0030.0278.19
5.0.50.0020.0226.67
5.0.40.0040.0196.52
5.0.30.0030.0326.34
5.0.20.0020.0216.30
5.0.10.0040.0196.27
5.0.00.0040.0306.27
4.4.90.0030.0184.78
4.4.80.0060.0124.76
4.4.70.0010.0214.75
4.4.60.0010.0174.76
4.4.50.0020.0174.77
4.4.40.0030.0254.71
4.4.30.0030.0164.76
4.4.20.0040.0144.85
4.4.10.0010.0174.85
4.4.00.0030.0254.76
4.3.110.0030.0164.67
4.3.100.0040.0144.67
4.3.90.0030.0144.64
4.3.80.0020.0254.59
4.3.70.0050.0124.63
4.3.60.0030.0144.63
4.3.50.0040.0144.63
4.3.40.0040.0234.53
4.3.30.0010.0173.31
4.3.20.0040.0143.29
4.3.10.0010.0163.25
4.3.00.0000.0237.27

preferences:
41.94 ms | 401 KiB | 5 Q