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);print_r('hi');

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.70.0090.00616.58
8.3.60.0160.00018.56
8.3.50.0070.01621.08
8.3.40.0150.00018.84
8.3.30.0100.00320.34
8.3.20.0040.00420.29
8.3.10.0090.00022.10
8.3.00.0040.00422.43
8.2.180.0120.00616.75
8.2.170.0070.00722.96
8.2.160.0090.00522.15
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0000.00819.36
8.2.110.0090.00021.98
8.2.100.0090.00317.91
8.2.90.0000.00719.21
8.2.80.0000.00819.23
8.2.70.0060.00317.50
8.2.60.0090.00017.93
8.2.50.0060.00318.07
8.2.40.0040.00418.34
8.2.30.0000.01118.00
8.2.20.0070.00017.72
8.2.10.0000.00817.63
8.2.00.0040.00417.74
8.1.280.0070.01125.92
8.1.270.0040.00424.66
8.1.260.0000.00826.35
8.1.250.0050.00328.09
8.1.240.0060.00323.81
8.1.230.0060.00619.21
8.1.220.0040.00417.77
8.1.210.0050.00318.77
8.1.200.0050.00517.37
8.1.190.0030.00517.53
8.1.180.0080.00019.14
8.1.170.0080.00018.48
8.1.160.0040.00420.96
8.1.150.0040.00418.59
8.1.140.0040.00417.33
8.1.130.0030.00317.88
8.1.120.0080.00017.49
8.1.110.0040.00417.50
8.1.100.0030.00517.52
8.1.90.0070.00317.36
8.1.80.0000.00717.50
8.1.70.0040.00417.46
8.1.60.0030.00617.59
8.1.50.0000.00717.49
8.1.40.0000.00717.49
8.1.30.0080.00017.57
8.1.20.0070.00017.66
8.1.10.0000.00717.59
8.1.00.0070.00017.53
8.0.300.0070.00018.77
8.0.290.0040.00417.18
8.0.280.0020.00518.28
8.0.270.0000.00717.16
8.0.260.0070.00016.73
8.0.250.0070.00016.99
8.0.240.0040.00416.98
8.0.230.0000.00716.99
8.0.220.0000.00716.88
8.0.210.0000.00716.89
8.0.200.0030.00316.82
8.0.190.0000.00816.95
8.0.180.0000.00716.95
8.0.170.0000.00716.85
8.0.160.0020.00516.89
8.0.150.0040.00416.71
8.0.140.0060.00316.69
8.0.130.0000.00613.28
8.0.120.0030.00716.83
8.0.110.0000.00816.90
8.0.100.0050.00316.84
8.0.90.0040.00416.93
8.0.80.0150.00016.84
8.0.70.0000.00716.91
8.0.60.0040.00416.93
8.0.50.0040.00416.93
8.0.30.0120.01117.31
8.0.20.0090.00917.40
8.0.10.0080.00016.97
8.0.00.0100.01216.67
7.4.330.0000.00615.00
7.4.320.0030.00316.60
7.4.300.0030.00316.43
7.4.290.0040.00716.59
7.4.280.0030.00316.49
7.4.270.0000.00716.56
7.4.260.0000.00713.32
7.4.250.0000.00716.54
7.4.240.0050.00216.59
7.4.230.0070.00016.68
7.4.220.0130.01416.60
7.4.210.0060.00916.58
7.4.200.0040.00416.42
7.4.190.0040.00416.76
7.4.160.0140.00316.51
7.4.150.0180.00017.40
7.4.140.0120.00817.86
7.4.130.0090.00916.53
7.4.120.0130.00716.58
7.4.110.0090.00916.32
7.4.100.0110.00616.51
7.4.90.0100.00716.66
7.4.80.0120.00819.39
7.4.70.0100.01016.55
7.4.60.0070.01016.43
7.4.50.0000.00516.41
7.4.40.0060.00922.77
7.4.30.0100.01016.53
7.4.00.0090.00715.05
7.3.330.0020.00213.25
7.3.320.0050.00013.16
7.3.310.0030.00316.38
7.3.300.0000.00716.18
7.3.290.0060.00916.32
7.3.280.0100.00716.30
7.3.270.0180.00017.40
7.3.260.0120.01516.55
7.3.250.0140.00416.63
7.3.240.0000.01716.50
7.3.230.0110.01116.39
7.3.210.0090.01216.27
7.3.200.0060.01519.39
7.3.190.0030.01416.30
7.3.180.0030.01316.62
7.3.170.0120.00616.43
7.3.160.0140.00416.46
7.3.120.0080.00814.77
7.3.110.0040.01414.54
7.3.100.0000.01214.87
7.3.90.0070.00714.87
7.3.80.0080.00514.57
7.3.70.0110.00414.93
7.3.60.0000.01414.71
7.3.50.0100.00614.84
7.3.40.0130.00314.76
7.3.30.0060.00914.89
7.3.20.0030.01016.89
7.3.10.0070.00716.65
7.3.00.0020.01216.59
7.2.330.0100.01016.75
7.2.320.0100.01316.70
7.2.310.0160.00516.44
7.2.300.0100.00716.54
7.2.290.0060.01016.75
7.2.250.0100.01015.27
7.2.240.0030.01515.24
7.2.230.0070.00314.79
7.2.220.0030.01015.25
7.2.210.0000.00915.03
7.2.200.0090.00915.13
7.2.190.0060.01014.73
7.2.180.0070.00714.82
7.2.170.0060.00915.19
7.2.130.0040.00817.17
7.2.120.0030.01416.98
7.2.110.0040.01116.88
7.2.100.0030.01316.94
7.2.90.0040.01416.79
7.2.80.0110.00716.97
7.2.70.0080.00816.85
7.2.60.0040.00717.04
7.2.50.0070.00716.96
7.2.40.0030.00617.04
7.2.30.0040.01116.94
7.2.20.0030.00916.95
7.2.10.0030.00717.07
7.2.00.0040.01118.17
7.1.330.0060.00615.83
7.1.320.0040.00715.83
7.1.310.0120.00315.88
7.1.300.0050.00515.64
7.1.290.0040.01115.80
7.1.280.0120.00415.62
7.1.270.0100.00315.66
7.1.260.0030.00715.99
7.1.250.0070.00315.46
7.1.100.0000.01218.18
7.1.70.0000.00817.38
7.1.60.0030.02119.32
7.1.50.0120.00916.96
7.1.00.0000.03722.27
7.0.200.1040.01014.71
7.0.140.0100.06721.95
7.0.70.0000.04719.91
7.0.60.0000.04719.88
7.0.50.0130.03720.30
7.0.40.0100.04320.04
7.0.30.0030.03720.17
7.0.20.0070.03320.14
7.0.10.0000.03720.14
7.0.00.0070.08020.14
5.6.280.0000.07321.11
5.6.220.0130.03020.67
5.6.210.0000.05020.75
5.6.200.0030.04721.07
5.6.190.0100.03321.04
5.6.180.0030.04321.00
5.6.170.0000.08320.93
5.6.160.0100.04321.11
5.6.150.0030.03720.93
5.6.140.0030.03721.13
5.6.130.0070.04021.04
5.6.120.0030.04321.08
5.6.110.0170.03021.15
5.6.100.0030.03721.02
5.6.90.0030.07320.99
5.6.80.0030.04020.49
5.6.70.0000.03720.33
5.6.60.0100.02720.34
5.6.50.0030.03320.36
5.6.40.0070.03720.38
5.6.30.0070.03720.41
5.6.20.0030.05320.38
5.6.10.0070.03720.45
5.6.00.0000.04320.45
5.5.360.0030.04020.38
5.5.350.0100.03720.41
5.5.340.0100.04020.90
5.5.330.0070.06020.73
5.5.320.0070.04320.89
5.5.310.0070.07720.79
5.5.300.0030.06320.75
5.5.290.0000.04720.85
5.5.280.0100.03020.82
5.5.270.0000.04720.76
5.5.260.0070.04020.91
5.5.250.0030.03320.70
5.5.240.0000.04320.26
5.5.230.0000.03720.20
5.5.220.0030.04020.15
5.5.210.0100.06320.14
5.5.200.0030.04020.27
5.5.190.0030.04320.21
5.5.180.0030.04720.08
5.5.160.0000.03720.14
5.5.150.0030.08320.22
5.5.140.0070.07320.27
5.5.130.0070.07720.26
5.5.120.0100.07320.26
5.5.110.0000.06020.25
5.5.100.0130.07720.17
5.5.90.0130.07020.05
5.5.80.0070.08319.96
5.5.70.0100.08320.13
5.5.60.0170.07020.00
5.5.50.0070.04020.04
5.5.40.0070.07720.14
5.5.30.0070.08019.99
5.5.20.0130.07320.05
5.5.10.0100.07720.03
5.5.00.0100.08020.04
5.4.450.0000.07719.39
5.4.440.0100.03319.29
5.4.430.0070.03719.35
5.4.420.0030.03319.46
5.4.410.0070.07319.14
5.4.400.0030.03719.13
5.4.390.0030.03719.10
5.4.380.0030.04719.11
5.4.370.0100.03318.80
5.4.360.0030.05319.20
5.4.350.0070.04718.95
5.4.340.0000.04019.05
5.4.320.0030.04019.04
5.4.310.0070.08019.11
5.4.300.0000.05018.99
5.4.290.0130.06318.90
5.4.280.0100.08319.25
5.4.270.0030.07318.91
5.4.260.0070.08319.07
5.4.250.0000.08718.95
5.4.240.0100.07319.02
5.4.230.0130.04318.96
5.4.220.0170.06719.11
5.4.210.0130.07719.23
5.4.200.0130.03019.04
5.4.190.0100.07018.89
5.4.180.0030.05718.97
5.4.170.0100.07318.93
5.4.160.0130.07318.80
5.4.150.0070.08018.76
5.4.140.0130.08016.37
5.4.130.0030.05316.26
5.4.120.0200.06316.27
5.4.110.0070.07016.34
5.4.100.0070.06716.34
5.4.90.0070.07716.44
5.4.80.0070.06016.22
5.4.70.0070.07716.29
5.4.60.0170.05316.32
5.4.50.0070.07316.30
5.4.40.0130.06016.26
5.4.30.0030.07716.26
5.4.20.0030.08016.38
5.4.10.0030.05716.30
5.4.00.0070.06715.83
5.3.290.0030.03314.66
5.3.280.0070.05714.59
5.3.270.0070.06314.46
5.3.260.0100.06314.60
5.3.250.0100.06714.59
5.3.240.0100.05014.59
5.3.230.0130.07014.54
5.3.220.0100.07314.43
5.3.210.0200.06714.43
5.3.200.0030.07314.53
5.3.190.0130.07014.48
5.3.180.0030.07714.40
5.3.170.0030.05314.56
5.3.160.0070.07714.42
5.3.150.0000.08714.55
5.3.140.0030.05714.55
5.3.130.0030.08714.38
5.3.120.0030.07714.53
5.3.110.0030.08014.51
5.3.100.0100.07013.90
5.3.90.0000.08314.01
5.3.80.0070.07014.01
5.3.70.0070.07313.85
5.3.60.0100.07313.98
5.3.50.0130.06313.72
5.3.40.0000.05313.88
5.3.30.0070.07013.68
5.3.20.0100.07013.56
5.3.10.0070.07013.64
5.3.00.0000.04013.60
5.2.170.0070.03712.23
5.2.160.0070.03312.23
5.2.150.0000.05012.23
5.2.140.0070.06312.23
5.2.130.0070.05712.23
5.2.120.0070.06012.23
5.2.110.0070.05312.23
5.2.100.0030.04312.23
5.2.90.0070.05712.23
5.2.80.0070.06312.23
5.2.70.0070.04312.23
5.2.60.0100.05312.23
5.2.50.0130.05712.23
5.2.40.0030.06312.23
5.2.30.0070.03312.23
5.2.20.0070.06312.23
5.2.10.0000.06712.23
5.2.00.0100.05712.23
5.1.60.0070.05012.23
5.1.50.0030.05712.23
5.1.40.0030.05312.23
5.1.30.0130.04712.23
5.1.20.0130.04012.23
5.1.10.0030.05712.23
5.1.00.0100.05012.23
5.0.50.0030.04712.23
5.0.40.0030.04312.23
5.0.30.0000.07712.23
5.0.20.0000.04312.23
5.0.10.0030.04312.23
5.0.00.0070.06012.23
4.4.90.0070.02312.23
4.4.80.0000.03712.23
4.4.70.0000.03312.23
4.4.60.0030.03712.23
4.4.50.0000.02012.23
4.4.40.0000.05312.23
4.4.30.0000.02312.23
4.4.20.0100.03012.23
4.4.10.0100.03012.23
4.4.00.0030.05312.23
4.3.110.0030.03312.23
4.3.100.0000.03712.23
4.3.90.0000.02712.23
4.3.80.0070.05012.23
4.3.70.0070.03012.23
4.3.60.0030.03312.23
4.3.50.0000.03712.23
4.3.40.0030.04312.23
4.3.30.0000.03712.23
4.3.20.0070.03012.23
4.3.10.0030.03712.23
4.3.00.0000.03712.23

preferences:
38.82 ms | 401 KiB | 5 Q