3v4l.org

run code in 300+ PHP versions simultaneously
<?php $rows = [ ['name' => 'blah', 'path' => 'A'], ['name' => 'blah', 'path' => 'AA'], ['name' => 'blah', 'path' => 'AB'], ['name' => 'blah', 'path' => 'C'], ['name' => 'blah', 'path' => 'D'], ['name' => 'blah', 'path' => 'B'], ['name' => 'blah', 'path' => 'BA'], ['name' => 'blah', 'path' => 'BAA'], ['name' => 'blah', 'path' => 'CA'], ]; function rowsToTree(&$array, $parent = '') { $children = []; foreach ($array as $i => &$row) { if ($parent === substr($row['path'], 0, -1)) { $found = rowsToTree($array, $row['path']); if ($found) { $row['children'] = $found; if ($parent) { unset($array[$i]); } } if ($parent) { $children[] = $row; unset($array[$i]); } } } return $children; } rowsToTree($rows); var_export($rows);

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.5.00.0130.00919.92
8.4.150.0020.00014.05
8.4.140.0130.00917.76
8.4.130.0130.00718.59
8.4.120.0120.00918.06
8.4.110.0160.00617.83
8.4.100.0110.00918.86
8.4.90.0140.00622.48
8.4.80.0110.00919.16
8.4.70.0040.00518.77
8.4.60.0130.00918.76
8.4.50.0120.00418.64
8.4.40.0030.00617.91
8.4.30.0100.01018.49
8.4.20.0070.00322.46
8.4.10.0070.00323.73
8.3.280.0110.01118.30
8.3.270.0170.00516.67
8.3.260.0050.00416.70
8.3.250.0070.01116.50
8.3.240.0070.01016.40
8.3.230.0140.00316.62
8.3.220.0110.00719.24
8.3.210.0130.00716.85
8.3.200.0110.00116.79
8.3.190.0140.00519.05
8.3.180.0100.00818.93
8.3.170.0120.00616.73
8.3.160.0140.00419.04
8.3.150.0060.00317.26
8.3.140.0080.00818.95
8.3.130.0040.00416.64
8.3.120.0060.00318.95
8.3.110.0030.00720.94
8.3.100.0130.00624.06
8.3.90.0060.00326.77
8.3.80.0060.00316.63
8.3.70.0100.01016.58
8.3.60.0030.01216.88
8.3.50.0150.00420.18
8.3.40.0110.00320.08
8.3.30.0160.00318.68
8.3.20.0030.00624.18
8.3.10.0050.00324.66
8.3.00.0040.00426.16
8.2.290.0120.00716.43
8.2.280.0060.00318.27
8.2.270.0050.00316.48
8.2.260.0070.00716.49
8.2.250.0030.00518.23
8.2.240.0030.00618.85
8.2.230.0070.00722.58
8.2.220.0060.00337.54
8.2.210.0080.00026.77
8.2.200.0040.00818.54
8.2.190.0100.01316.75
8.2.180.0030.01325.92
8.2.170.0070.00719.05
8.2.160.0070.00722.96
8.2.150.0000.00725.66
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0050.00326.16
8.2.110.0070.00322.16
8.2.100.0090.00317.72
8.2.90.0060.00319.08
8.2.80.0000.00818.91
8.2.70.0030.00617.50
8.2.60.0080.00017.93
8.2.50.0030.00518.07
8.2.40.0040.00818.28
8.2.30.0000.00718.05
8.2.20.0050.00219.32
8.2.10.0060.00318.18
8.2.00.0020.00519.18
8.1.330.0120.00615.97
8.1.320.0100.01117.89
8.1.310.0080.00016.17
8.1.300.0090.00920.16
8.1.290.0060.00330.84
8.1.280.0120.00625.92
8.1.270.0060.00324.66
8.1.260.0070.00026.35
8.1.250.0070.00028.09
8.1.240.0090.00020.41
8.1.230.0030.00717.70
8.1.220.0050.00317.78
8.1.210.0000.00818.77
8.1.200.0030.00617.36
8.1.190.0030.00717.35
8.1.180.0030.00618.10
8.1.170.0040.00418.44
8.1.160.0050.00318.95
8.1.150.0040.00418.64
8.1.140.0050.00517.44
8.1.130.0030.00518.81
8.1.120.0040.00417.49
8.1.110.0070.00317.34
8.1.100.0090.00617.38
8.1.90.0130.00217.47
8.1.80.0090.00617.37
8.1.70.0100.00517.38
8.1.60.0070.01117.54
8.1.50.0160.00217.52
8.1.40.0130.00417.57
8.1.30.0110.00417.54
8.1.20.0000.01517.52
8.1.10.0130.00417.41
8.1.00.0190.00017.50
8.0.300.0020.00518.77
8.0.290.0000.00716.75
8.0.280.0000.00718.45
8.0.270.0060.00317.22
8.0.260.0000.00718.54
8.0.250.0030.00316.95
8.0.240.0000.01016.84
8.0.230.0110.00416.93
8.0.220.0080.00316.71
8.0.210.0100.00016.86
8.0.200.0060.00616.86
8.0.190.0050.00716.72
8.0.180.0060.00616.71
8.0.170.0140.00016.89
8.0.160.0070.00716.67
8.0.150.0110.00416.84
8.0.140.0050.01016.81
8.0.130.0070.00716.77
8.0.120.0100.00416.85
8.0.110.0100.00316.80
8.0.100.0150.00016.87
8.0.90.0120.00216.85
8.0.80.0140.00316.82
8.0.70.0160.00016.89
8.0.60.0120.00016.82
8.0.50.0060.00916.85
8.0.30.0110.00516.87
8.0.20.0080.00416.96
8.0.10.0060.00816.98
7.4.330.0000.00615.55
7.4.320.0060.00616.58
7.4.300.0130.00516.59
7.4.290.0060.01216.48
7.4.280.0130.00416.55
7.4.270.0140.00316.52
7.4.260.0150.00316.46
7.4.250.0130.00516.46
7.4.240.0180.00016.64
7.4.230.0140.00616.45
7.4.220.0170.00016.43
7.4.210.0110.00616.48
7.4.200.0110.00616.62
7.4.190.0150.00016.39
7.4.180.0080.00816.50
7.4.160.0170.00016.54
7.4.150.0100.00716.43
7.4.140.0150.00016.49
7.4.130.0050.00616.50
7.4.120.0100.00516.52
7.4.110.0090.00716.43
7.4.100.0030.01016.53
7.4.90.0160.00216.36
7.4.80.0130.00316.22
7.4.70.0110.00516.41
7.4.60.0120.00516.46
7.4.50.0070.00516.28
7.4.40.0100.00316.21
7.4.30.0050.00516.30
7.4.20.0110.00316.41
7.4.10.0090.00016.45
7.4.00.0050.00216.24

preferences:
138.95 ms | 403 KiB | 5 Q