3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( array("title" => 1, "children" => array( array( "selected" => true, "key" => 100, "children" => array() ) ), array( "selected" => true, "key" => 500, "children" => array() ), array( "selected" => true, "key" => 200, "children" => array( array( "selected" => true, "key" => 300, "children" => array( array( "selected" => true, "key" => 400, "children" => array() ) ) ) ) ) ) ); $selectedValues = array(); $iterator = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($array)); foreach ($iterator as $key => $value) { if ($key == "key") { echo $value .PHP_EOL; var_dump($iterator->getChildren()); } } /* $selectedValues = array(); $iterator = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($array)); foreach ($iterator as $key => $value) { if ($key == "selected") { $depth = $iterator->getDepth(); $subIterator = $iterator->getSubIterator($depth); foreach ($subIterator as $key2 => $value2) { if ($key2 == "key") { echo $value2 . PHP_EOL; } } } } */

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.0150.00716.75
8.3.50.0130.00821.10
8.3.40.0040.01518.88
8.3.30.0060.00918.75
8.3.20.0040.00420.35
8.3.10.0030.00523.63
8.3.00.0080.00022.46
8.2.180.0130.00618.41
8.2.170.0140.00322.96
8.2.160.0070.01020.33
8.2.150.0030.00624.18
8.2.140.0110.00724.66
8.2.130.0050.00326.16
8.2.120.0030.00617.63
8.2.110.0090.00019.29
8.2.100.0090.00317.63
8.2.90.0060.00319.21
8.2.80.0040.00417.97
8.2.70.0000.00917.62
8.2.60.0000.00817.80
8.2.50.0080.00018.07
8.2.40.0050.00321.18
8.2.30.0080.00019.72
8.2.20.0000.00817.83
8.2.10.0000.00718.19
8.2.00.0040.00418.09
8.1.280.0040.01225.92
8.1.270.0050.00320.33
8.1.260.0000.00826.35
8.1.250.0050.00228.09
8.1.240.0080.00022.09
8.1.230.0090.00317.48
8.1.220.0060.00317.74
8.1.210.0000.00818.77
8.1.200.0030.00717.47
8.1.190.0060.00317.25
8.1.180.0040.00418.10
8.1.170.0060.00318.63
8.1.160.0040.00422.02
8.1.150.0050.00318.91
8.1.140.0030.00617.46
8.1.130.0030.00517.78
8.1.120.0060.00317.49
8.1.110.0070.00017.45
8.1.100.0030.00617.45
8.1.90.0050.00317.39
8.1.80.0000.00717.47
8.1.70.0080.00017.39
8.1.60.0040.00417.59
8.1.50.0030.00517.52
8.1.40.0000.00817.52
8.1.30.0030.00617.68
8.1.20.0000.00717.68
8.1.10.0080.00017.52
8.1.00.0040.00417.36
8.0.300.0090.00018.77
8.0.290.0000.00716.75
8.0.280.0000.00818.47
8.0.270.0040.00417.21
8.0.260.0030.00317.29
8.0.250.0050.00216.93
8.0.240.0070.00017.00
8.0.230.0000.00716.99
8.0.220.0050.00216.86
8.0.210.0000.00716.88
8.0.200.0000.00616.96
8.0.190.0000.00716.93
8.0.180.0000.00817.00
8.0.170.0030.00517.04
8.0.160.0040.00417.00
8.0.150.0040.00416.87
8.0.140.0070.00316.92
8.0.130.0040.00413.38
8.0.120.0050.00316.88
8.0.110.0000.00716.90
8.0.100.0050.00216.86
8.0.90.0000.00716.83
8.0.80.0030.01217.03
8.0.70.0070.00016.93
8.0.60.0000.00716.85
8.0.50.0030.00517.03
8.0.30.0120.00817.22
8.0.20.0120.00917.42
8.0.10.0040.00417.20
8.0.00.0150.00716.84
7.4.330.0060.00015.12
7.4.320.0000.00616.60
7.4.300.0030.00316.42
7.4.290.0000.00716.52
7.4.280.0050.00316.52
7.4.270.0040.00416.65
7.4.260.0030.00316.62
7.4.250.0000.00816.45
7.4.240.0060.00216.52
7.4.230.0070.00016.61
7.4.220.0100.01616.51
7.4.210.0070.01316.52
7.4.200.0040.00416.42
7.4.160.0160.00016.62
7.4.150.0120.01317.40
7.4.140.0110.01117.86
7.4.130.0110.00916.61
7.4.120.0080.01016.57
7.4.110.0120.00616.43
7.4.100.0150.00716.55
7.4.90.0110.00716.47
7.4.80.0110.00719.39
7.4.70.0130.00416.46
7.4.60.0030.01316.43
7.4.50.0020.00216.21
7.4.40.0080.00816.56
7.4.30.0120.00616.75
7.4.00.0100.00814.86
7.3.330.0040.00413.24
7.3.320.0000.00613.18
7.3.310.0030.00316.43
7.3.300.0030.00316.14
7.3.290.0080.00816.33
7.3.280.0080.01116.33
7.3.270.0100.00717.40
7.3.260.0150.00916.55
7.3.250.0110.00916.47
7.3.240.0120.00616.35
7.3.230.0100.00616.54
7.3.210.0100.00716.56
7.3.200.0100.01119.39
7.3.190.0080.01116.44
7.3.180.0100.00716.54
7.3.170.0030.01816.34
7.3.160.0060.01616.50
7.3.120.0070.01114.64
7.3.110.0030.01315.13
7.3.100.0080.00415.00
7.3.90.0070.00414.95
7.3.80.0030.00615.00
7.3.70.0170.00014.96
7.3.60.0000.00814.89
7.3.50.0030.00914.68
7.3.40.0040.01114.94
7.3.30.0110.00314.63
7.3.20.0090.00316.62
7.3.10.0060.00616.70
7.3.00.0000.01416.80
7.2.330.0150.00316.78
7.2.320.0040.01516.73
7.2.310.0080.01016.65
7.2.300.0090.00616.68
7.2.290.0100.00716.64
7.2.250.0090.00914.97
7.2.240.0070.01415.24
7.2.230.0100.00715.29
7.2.220.0060.00914.99
7.2.210.0100.00715.07
7.2.200.0070.01015.21
7.2.190.0030.01414.88
7.2.180.0090.00915.13
7.2.170.0030.01015.17
7.2.60.0040.01116.66
7.2.00.0040.00819.73
7.1.330.0060.00615.89
7.1.320.0000.00915.69
7.1.310.0040.01115.89
7.1.300.0070.00715.78
7.1.290.0000.00815.84
7.1.280.0040.00715.68
7.1.270.0050.00315.68
7.1.260.0040.01115.81
7.1.200.0000.01115.63
7.1.100.0090.01318.10
7.1.70.0000.00717.23
7.1.60.0070.01720.03
7.1.50.0120.00917.03
7.1.00.0070.07322.42
7.0.200.0110.00016.79
7.0.60.0130.07720.07
7.0.50.0000.07017.90
7.0.40.0100.06020.20
7.0.30.0500.07720.09
7.0.20.0170.07320.12
7.0.10.0200.08020.09
7.0.00.0030.05720.03
5.6.280.0030.03020.85
5.6.210.0070.07020.74
5.6.200.0070.04318.22
5.6.190.0100.08720.41
5.6.180.0430.06320.47
5.6.170.0170.05720.62
5.6.160.0070.08720.46
5.6.150.0070.08318.15
5.6.140.0070.07018.16
5.6.130.0000.04318.17
5.6.120.0130.04721.14
5.6.110.0030.09321.09
5.6.100.0070.08321.11
5.6.90.0030.08021.09
5.6.80.0230.06320.52
5.6.70.4370.04020.27
5.5.350.0100.07020.52
5.5.340.0070.08718.08
5.5.330.0070.04720.27
5.5.320.3030.04320.23
5.5.310.0330.04720.27
5.5.300.0130.07017.91
5.5.290.0070.06018.04
5.5.280.0100.08020.77
5.5.270.0170.05020.79
5.5.260.0100.06320.86
5.5.250.0100.08020.56
5.5.240.3970.03720.16
5.4.450.0730.06719.46
5.4.440.0900.05019.46
5.4.430.1000.05319.43
5.4.420.0800.05719.39
5.4.410.0730.06019.43
5.4.400.0830.05319.28
5.4.390.0730.06019.28
5.4.380.0800.05319.06
5.4.370.0970.05319.14
5.4.360.0930.05719.20
5.4.350.0770.06018.98
5.4.340.0830.05719.22
5.4.320.0800.06719.05
5.4.310.0970.06319.27
5.4.300.1130.05719.27
5.4.290.0930.05319.21
5.4.280.0870.05719.31
5.4.270.0830.05319.00
5.4.260.0970.05019.13
5.4.250.0830.05719.12
5.4.240.0800.05719.13
5.4.230.0800.06019.00
5.4.220.0770.06719.21
5.4.210.0900.05319.01
5.4.200.1000.07316.73
5.4.190.0830.05318.97
5.4.180.0900.04018.88
5.4.170.0870.05018.88
5.4.160.0800.06319.06
5.4.150.0830.06019.06
5.4.140.0830.05016.52
5.4.130.0900.04316.32
5.4.120.0800.04716.53
5.4.110.0870.04316.43
5.4.100.0800.05316.40
5.4.90.0730.05316.38
5.4.80.0930.05016.43
5.4.70.0930.06016.53
5.4.60.0370.05016.43
5.4.50.0000.07316.53
5.4.40.0030.06716.27
5.4.30.0030.07016.42
5.4.20.0270.05316.37

preferences:
64.01 ms | 401 KiB | 5 Q