3v4l.org

run code in 300+ PHP versions simultaneously
<?php $rows = [ ['name' => 'blah', 'path' => 'A'], ['name' => 'blah1', 'path' => 'AA'], ['name' => 'blah', 'path' => 'AB'], ['name' => 'blah', 'path' => 'C'], ['name' => 'blah', 'path' => 'D'], ['name' => 'blah2', 'path' => 'AA'], ['name' => 'blah', 'path' => 'B'], ['name' => 'blah', 'path' => 'BA'], ['name' => 'blah', 'path' => 'BAA'], ['name' => 'blah', 'path' => 'CA'], ]; $copy = $rows; uasort($rows, fn($a, $b) => $b['path'] <=> $a['path']); foreach ($rows as $i => $row1) { foreach ($rows as $j => &$row2) { if (substr($row1['path'], 0, -1) === $row2['path']) { $copy[$j]['children'][] = $row1; unset($copy[$i]); } } } var_export($copy);

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.0120.01020.13
8.4.150.0020.00014.05
8.4.140.0130.00817.58
8.4.130.0090.00717.73
8.4.120.0060.00320.73
8.4.110.0100.00922.36
8.4.100.0150.00517.84
8.4.90.0120.00720.52
8.4.80.0080.00720.60
8.4.70.0050.00318.86
8.4.60.0070.01320.32
8.4.50.0070.00518.79
8.4.40.0120.00818.05
8.4.30.0160.00318.89
8.4.20.0090.00622.59
8.4.10.0100.01323.80
8.3.280.0080.01218.41
8.3.270.0140.00616.45
8.3.260.0070.01316.70
8.3.250.0100.00918.77
8.3.240.0120.00716.60
8.3.230.0150.00516.76
8.3.220.0080.01018.86
8.3.210.0100.00816.79
8.3.200.0080.00016.60
8.3.190.0090.00619.03
8.3.180.0070.00219.21
8.3.170.0120.00616.92
8.3.160.0110.00816.68
8.3.150.0070.01117.41
8.3.140.0070.00716.50
8.3.130.0050.00316.64
8.3.120.0030.00618.99
8.3.110.0030.00520.94
8.3.100.0140.00424.06
8.3.90.0070.00326.77
8.3.80.0080.00016.63
8.3.70.0090.00616.75
8.3.60.0070.01116.50
8.3.50.0040.01120.12
8.3.40.0030.01020.29
8.3.30.0030.01218.85
8.3.20.0050.00524.18
8.3.10.0040.00424.66
8.3.00.0040.00426.16
8.2.290.0050.00317.09
8.2.280.0140.00518.33
8.2.270.0090.00916.84
8.2.260.0040.00417.06
8.2.250.0070.01118.28
8.2.240.0050.00317.07
8.2.230.0100.00022.58
8.2.220.0030.00737.54
8.2.210.0060.00826.77
8.2.200.0060.00316.63
8.2.190.0140.00717.00
8.2.180.0090.00625.92
8.2.170.0140.00719.04
8.2.160.0120.00322.96
8.2.150.0070.00025.66
8.2.140.0080.00024.66
8.2.130.0000.00826.16
8.2.120.0040.00426.16
8.2.110.0100.00020.98
8.2.100.0080.00417.84
8.2.90.0040.00418.09
8.2.80.0000.00818.22
8.2.70.0000.00917.50
8.2.60.0050.00317.75
8.2.50.0080.00018.05
8.2.40.0050.00318.41
8.2.30.0050.00318.07
8.2.20.0050.00319.23
8.2.10.0000.00718.01
8.2.00.0000.00819.32
8.1.330.0110.00822.12
8.1.320.0150.00516.26
8.1.310.0090.00916.41
8.1.300.0030.00616.42
8.1.290.0000.01018.88
8.1.280.0070.00725.92
8.1.270.0040.00424.66
8.1.260.0000.00726.35
8.1.250.0040.00428.09
8.1.240.0000.00823.83
8.1.230.0080.00420.79
8.1.220.0080.00017.79
8.1.210.0040.00418.77
8.1.200.0060.00317.23
8.1.190.0040.00417.22
8.1.180.0040.00418.10
8.1.170.0080.00017.62
8.1.160.0000.00820.66
8.1.150.0000.00718.65
8.1.140.0030.00517.39
8.1.130.0030.00318.95
8.1.120.0050.00317.50
8.1.110.0030.00717.37
8.1.100.0140.00217.39
8.1.90.0160.00017.48
8.1.80.0140.00217.45
8.1.70.0120.00317.37
8.1.60.0150.00317.55
8.1.50.0140.00517.45
8.1.40.0100.01017.45
8.1.30.0160.00317.64
8.1.20.0140.00417.57
8.1.10.0110.00717.41
8.1.00.0100.00717.47
8.0.300.0000.00720.04
8.0.290.0080.00016.75
8.0.280.0000.00818.47
8.0.270.0030.00316.81
8.0.260.0000.00618.38
8.0.250.0040.00417.02
8.0.240.0120.00316.86
8.0.230.0070.00416.70
8.0.220.0100.00216.82
8.0.210.0090.00316.89
8.0.200.0120.00016.73
8.0.190.0070.00716.92
8.0.180.0100.00516.80
8.0.170.0110.00316.93
8.0.160.0120.00416.89
8.0.150.0130.00316.86
8.0.140.0050.01016.72
8.0.130.0080.00816.81
8.0.120.0000.01416.85
8.0.110.0120.00316.84
8.0.100.0160.00016.79
8.0.90.0040.01216.90
8.0.80.0120.00316.71
8.0.70.0130.00316.88
8.0.60.0100.00516.70
8.0.50.0030.00716.73
8.0.30.0120.00016.71
8.0.20.0130.00016.90
8.0.10.0070.00317.02
7.4.330.0020.00215.55
7.4.320.0060.00316.51
7.4.300.0030.00716.47
7.4.290.0070.00316.46
7.4.280.0140.00316.41
7.4.270.0120.00416.48
7.4.260.0140.00416.59
7.4.250.0080.00416.40
7.4.240.0090.00416.38
7.4.230.0070.00416.01
7.4.220.0080.00316.37
7.4.210.0060.00616.47
7.4.200.0110.00016.41
7.4.190.0050.00516.03
7.4.180.0000.01016.25
7.4.160.0000.01016.50
7.4.150.0050.00516.45
7.4.140.0120.00016.44
7.4.130.0060.00316.49
7.4.120.0070.00416.31
7.4.110.0080.00416.46
7.4.100.0060.00316.19
7.4.90.0100.00016.09
7.4.80.0060.00616.30
7.4.70.0000.01116.23
7.4.60.0100.00516.47
7.4.50.0130.00316.29
7.4.40.0100.00516.45
7.4.30.0040.01116.36
7.4.20.0080.00816.42
7.4.10.0100.00616.45
7.4.00.0080.00816.47

preferences:
117.85 ms | 403 KiB | 5 Q