3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( 55 => array( 'ident' => 'test 1', 'depth' => 1, ), 77 => array( 'parent_id' => 55, 'ident' => 'test 2', 'depth' => 2, ), 109 => array( 'parent_id' => 77, 'ident' => 'test 3', 'depth' => 3, ), 78 => array( 'parent_id' => 55, 'ident' => 'test 4', 'depth' => 2, ), 25 => array( 'ident' => 'test 5', 'depth' => 1, ) ); foreach ($array as $key => &$sub) { if (isset($sub['parent_id'])) { $array[$sub['parent_id']]['children'][$key] = &$sub; } } unset($sub); // unset the reference to make sure to not overwrite it later... // now remove the entries with parents foreach ($array as $key => $sub) { if (isset($sub['parent_id'])) unset($array[$key]); } var_dump($array);

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.0070.01116.36
8.3.50.0120.00522.00
8.3.40.0070.00718.84
8.3.30.0090.00919.27
8.3.20.0030.00520.34
8.3.10.0050.00321.85
8.3.00.0040.00419.38
8.2.180.0110.00716.73
8.2.170.0180.00322.96
8.2.160.0070.01018.75
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0070.00026.16
8.2.120.0040.00422.08
8.2.110.0030.00622.26
8.2.100.0060.00617.91
8.2.90.0100.00017.75
8.2.80.0040.00418.16
8.2.70.0050.00318.05
8.2.60.0040.00418.04
8.2.50.0030.00518.10
8.2.40.0040.00422.24
8.2.30.0020.00518.18
8.2.20.0080.00017.66
8.2.10.0100.00018.14
8.2.00.0040.00717.70
8.1.280.0110.00725.92
8.1.270.0040.00423.66
8.1.260.0070.00728.09
8.1.250.0080.00028.09
8.1.240.0060.00323.84
8.1.230.0040.00819.21
8.1.220.0060.00317.78
8.1.210.0080.00018.77
8.1.200.0030.00617.35
8.1.190.0030.00517.13
8.1.180.0000.00918.10
8.1.170.0000.00818.66
8.1.160.0070.00022.07
8.1.150.0000.00818.70
8.1.140.0070.00017.37
8.1.130.0030.00317.77
8.1.120.0040.00417.36
8.1.110.0000.00717.42
8.1.100.0000.00717.44
8.1.90.0040.00417.39
8.1.80.0040.00417.48
8.1.70.0030.00317.46
8.1.60.0060.00317.64
8.1.50.0040.00417.45
8.1.40.0080.00017.54
8.1.30.0000.00817.51
8.1.20.0040.00417.70
8.1.10.0040.00417.50
8.1.00.0000.00817.36
8.0.300.0000.00821.51
8.0.290.0030.00516.63
8.0.280.0000.00818.31
8.0.270.0000.00717.22
8.0.260.0040.00417.32
8.0.250.0000.00716.98
8.0.240.0000.00716.96
8.0.230.0000.00716.94
8.0.220.0000.00716.89
8.0.210.0030.00316.78
8.0.200.0000.00616.82
8.0.190.0000.00817.03
8.0.180.0080.00016.77
8.0.170.0040.00416.95
8.0.160.0050.00216.86
8.0.150.0050.00316.71
8.0.140.0040.00416.86
8.0.130.0000.00613.41
8.0.120.0040.00416.90
8.0.110.0030.00616.92
8.0.100.0070.00016.91
8.0.90.0040.00416.96
8.0.80.0040.01116.91
8.0.70.0040.00416.73
8.0.60.0000.00816.92
8.0.50.0040.00416.80
8.0.30.0140.00517.14
8.0.20.0050.01517.40
8.0.10.0040.00417.00
8.0.00.0090.01016.81
7.4.330.0000.00515.00
7.4.320.0060.00016.61
7.4.300.0070.00016.51
7.4.290.0070.00016.50
7.4.280.0030.00516.49
7.4.270.0070.00016.46
7.4.260.0030.00316.62
7.4.250.0070.00016.57
7.4.240.0050.00216.57
7.4.230.0000.00716.50
7.4.220.0060.01116.43
7.4.210.0090.01216.68
7.4.200.0000.00716.54
7.4.190.0030.00316.37
7.4.160.0100.01016.50
7.4.150.0160.00317.40
7.4.140.0100.01117.86
7.4.130.0120.00816.40
7.4.120.0140.00516.45
7.4.110.0060.01216.45
7.4.100.0100.00716.55
7.4.90.0000.01716.46
7.4.80.0120.00819.39
7.4.70.0140.00916.74
7.4.60.0080.00816.47
7.4.50.0080.00016.60
7.4.40.0100.00722.77
7.4.30.0100.00716.36
7.4.00.0060.01115.03
7.3.330.0000.00513.16
7.3.320.0020.00213.17
7.3.310.0000.00716.35
7.3.300.0070.00016.37
7.3.290.0070.00716.37
7.3.280.0100.00916.36
7.3.270.0130.00317.40
7.3.260.0070.01116.61
7.3.250.0130.01316.51
7.3.240.0070.01516.43
7.3.230.0140.00316.40
7.3.210.0100.00916.52
7.3.200.0100.01019.39
7.3.190.0150.00416.38
7.3.180.0130.00316.37
7.3.170.0100.00716.70
7.3.160.0060.01116.39
7.3.120.0100.00614.80
7.2.330.0040.01416.82
7.2.320.0100.01616.80
7.2.310.0070.01116.59
7.2.300.0110.01116.81
7.2.290.0070.01016.55
7.2.60.0070.01016.97
7.2.00.0280.00519.34
7.1.200.0070.00715.87
7.1.100.0120.00318.14
7.1.70.0100.00017.38
7.1.60.0030.01016.96
7.1.50.0070.01717.06
7.1.00.0100.06722.37
7.0.200.0080.00816.88
7.0.140.0000.07722.07
7.0.60.0030.04320.07
7.0.50.0130.07317.81
7.0.40.0070.06320.04
7.0.30.0230.05320.18
7.0.20.0200.06720.19
7.0.10.0070.08020.33
7.0.00.0030.05320.00
5.6.280.0030.09721.13
5.6.210.0030.08020.75
5.6.200.0070.08018.12
5.6.190.0070.07720.48
5.6.180.0200.03720.39
5.6.170.0330.04720.42
5.6.160.0070.06320.48
5.6.150.0200.05318.22
5.6.140.0030.04318.08
5.6.130.0000.05318.16
5.6.120.0070.08321.03
5.6.110.0130.07020.97
5.6.100.0130.07020.88
5.6.90.0070.05720.92
5.6.80.0100.07720.40
5.6.70.3270.03320.37
5.5.350.0100.07720.43
5.5.340.0170.07017.91
5.5.330.0070.08320.15
5.5.320.0230.04020.28
5.5.310.0230.05020.28
5.5.300.0000.04018.00
5.5.290.0000.05718.03
5.5.280.0130.07720.65
5.5.270.0070.08720.94
5.5.260.0030.04020.83
5.5.250.0070.03720.49
5.5.240.0200.06320.27
5.4.450.0030.05719.50
5.4.440.0100.08019.50
5.4.430.0030.04319.44
5.4.420.0100.07719.43
5.4.410.0070.03719.27
5.4.400.0100.07019.12
5.4.390.0030.04319.08
5.4.380.0070.08018.92
5.4.370.0130.07319.14
5.4.360.0100.03319.05
5.4.350.0130.07318.79
5.4.340.0130.05719.09
5.4.320.0100.07318.79
5.4.310.0070.07319.08
5.4.300.0030.05019.17
5.4.290.0030.07719.14
5.4.280.0070.06319.13
5.4.270.0000.04719.11
5.4.260.0070.05319.09
5.4.250.0070.04018.91
5.4.240.0070.05019.14
5.4.230.0000.08718.93
5.4.220.0100.05318.78
5.4.210.0100.07719.16
5.4.200.0100.07318.90
5.4.190.0100.06719.14
5.4.180.0030.06019.12
5.4.170.0130.06718.90
5.4.160.0130.04018.99
5.4.150.0030.08018.77
5.4.140.0130.06716.34
5.4.130.0100.03016.24
5.4.120.0130.07016.25
5.4.110.0100.06316.36
5.4.100.0100.07016.41
5.4.90.0030.05016.25
5.4.80.0070.06716.29
5.4.70.0030.05716.22
5.4.60.0030.06316.32
5.4.50.0000.06716.34
5.4.40.0070.07716.22
5.4.30.0130.05716.24
5.4.20.0070.03716.20
5.4.10.0000.05316.35
5.4.00.0070.03715.64
5.3.290.0100.05014.59
5.3.280.0100.04314.56
5.3.270.0070.07014.54
5.3.260.0030.07714.57
5.3.250.0100.07314.55
5.3.240.0030.08014.50
5.3.230.0070.07314.48
5.3.220.0100.07314.50
5.3.210.0030.07314.50
5.3.200.0070.05014.37
5.3.190.0070.04714.66
5.3.180.0100.03714.49
5.3.170.0130.06314.65
5.3.160.0070.04714.49
5.3.150.0030.07714.51
5.3.140.0100.05314.52
5.3.130.0100.07014.53
5.3.120.0130.07014.48
5.3.110.0100.07714.50
5.3.100.0030.06713.92
5.3.90.0100.04313.96
5.3.80.0070.07014.04
5.3.70.0100.05713.98
5.3.60.0030.07013.93
5.3.50.0000.07313.88
5.3.40.0070.04713.91
5.3.30.0070.06713.73
5.3.20.0030.06313.63
5.3.10.0030.05013.60
5.3.00.0030.05313.46
5.2.170.0000.03311.05
5.2.160.0000.04711.08
5.2.150.0100.05711.05
5.2.140.0070.04311.14
5.2.130.0030.03311.05
5.2.120.0070.05310.99
5.2.110.0030.06311.07
5.2.100.0070.06011.05
5.2.90.0030.04311.07
5.2.80.0030.04311.03
5.2.70.0100.04010.95
5.2.60.0030.06311.03
5.2.50.0000.05311.02
5.2.40.0000.06310.93
5.2.30.0070.05710.82
5.2.20.0030.05710.94
5.2.10.0000.04710.76
5.2.00.0100.02310.69
5.1.60.0030.05310.02
5.1.50.0100.0439.99
5.1.40.0000.0309.88
5.1.30.0030.03310.19
5.1.20.0030.06010.23
5.1.10.0070.05310.06
5.1.00.0030.0639.91
5.0.50.0030.0378.62
5.0.40.0030.0308.41
5.0.30.0100.0478.25
5.0.20.0030.0208.27
5.0.10.0000.0208.17
5.0.00.0000.0338.17
4.4.90.0000.0307.81
4.4.80.0000.0337.81
4.4.70.0030.0177.81
4.4.60.0070.0307.81
4.4.50.0030.0137.81
4.4.40.0000.0407.81
4.4.30.0000.0307.81
4.4.20.0070.0237.81
4.4.10.0000.0207.81
4.4.00.0070.0477.81
4.3.110.0000.0407.81
4.3.100.0000.0177.81
4.3.90.0000.0177.81
4.3.80.0030.0237.81
4.3.70.0000.0207.81
4.3.60.0070.0277.81
4.3.50.0100.0107.81
4.3.40.0070.0377.81
4.3.30.0000.0307.81
4.3.20.0000.0237.81
4.3.10.0000.0207.81
4.3.00.0030.0207.81

preferences:
50.07 ms | 401 KiB | 5 Q