3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'children' => [ [ 'id' => 123, 'title' => 'test', 'children' => [ [ 'id' => 345, 'title' => 'test 1', 'children' => [], ], [ 'id' => 567, 'title' => 'test 2', 'children' => [ [ 'id' => 789, 'title' => 'test 3', 'children' => [], ], [ 'id' => 333, 'title' => 'tset 4', 'children' => [ [ 'id' => 222, 'title' => 'test 5', 'children' => [], ], [ 'id' => 111, 'title' => 'test 55', 'children' => [], ], [ 'id' => 444, 'title' => 'test 556', 'children' => [], ], [ 'id' => 666, 'title' => 'test44', 'children' => [], ], ], ], [ 'id' => '5556', 'identifier' => 'test 2', 'children' => [ [ 'id' => 888, 'title' => 'test 2', 'children' => [], ], [ 'id' => 255, 'title' => 'tset', 'children' => [], ], [ 'id' => 454, 'title' => 'warm-up-5837', 'children' => [], ], ], ], ], ], ], ], ], ]; function flattenTree(array $tree): array { $flat = []; foreach ($tree['children'] ?? [] as $child) { $flat[] = array_filter($child, 'is_scalar'); if (!empty($child['children'])) { array_push($flat, ...flattenTree($child, $flat)); } } return $flat; } var_export(flattenTree($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.5.00.0140.00919.80
8.4.150.0020.00014.05
8.4.140.0150.01217.17
8.4.130.0120.00818.67
8.4.120.0140.00623.82
8.4.110.0110.00619.01
8.4.100.0110.00718.73
8.4.90.0110.00920.66
8.4.80.0050.00418.61
8.4.70.0060.00817.95
8.4.60.0130.00718.80
8.4.50.0110.00918.52
8.4.40.0100.00320.82
8.4.30.0030.00618.78
8.4.20.0100.01020.48
8.4.10.0060.01323.66
8.3.280.0100.00918.49
8.3.270.0090.01016.55
8.3.260.0120.00816.66
8.3.250.0130.00618.84
8.3.240.0140.00517.22
8.3.230.0090.01016.32
8.3.220.0040.00319.17
8.3.210.0060.01216.56
8.3.200.0070.00216.70
8.3.190.0130.00617.33
8.3.180.0110.00816.65
8.3.170.0110.00720.88
8.3.160.0180.00017.21
8.3.150.0110.00818.98
8.3.140.0110.00717.29
8.3.130.0090.00016.55
8.3.120.0100.00720.69
8.3.110.0090.00018.34
8.3.100.0030.00618.31
8.3.90.0000.00826.77
8.3.80.0000.00918.68
8.3.70.0090.01216.63
8.3.60.0110.00718.18
8.3.50.0110.00716.55
8.3.40.0070.00719.85
8.3.30.0140.00018.79
8.3.20.0050.00324.18
8.3.10.0040.00424.66
8.3.00.0080.00026.16
8.2.290.0090.00920.46
8.2.280.0050.00822.34
8.2.270.0110.00716.98
8.2.260.0060.00920.88
8.2.250.0080.00018.24
8.2.240.0030.00618.99
8.2.230.0030.00520.94
8.2.220.0030.00624.06
8.2.210.0040.00426.77
8.2.200.0090.00016.38
8.2.190.0140.00416.58
8.2.180.0090.00625.92
8.2.170.0090.00619.14
8.2.160.0070.00722.96
8.2.150.0040.00425.66
8.2.140.0070.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00420.75
8.2.110.0060.00321.02
8.2.100.0120.00017.84
8.2.90.0040.00417.95
8.2.80.0000.00820.07
8.2.70.0030.00617.50
8.2.60.0080.00017.63
8.2.50.0140.00319.52
8.2.40.0120.00319.52
8.2.30.0150.00319.52
8.2.20.0080.00819.52
8.2.10.0120.00319.52
8.2.00.0040.00419.52
8.1.330.0070.01221.85
8.1.320.0120.00816.25
8.1.310.0000.00916.58
8.1.300.0090.00018.48
8.1.290.0040.00730.84
8.1.280.0070.00725.92
8.1.270.0000.00822.24
8.1.260.0050.00326.35
8.1.250.0000.00728.09
8.1.240.0030.00624.02
8.1.230.0080.00320.99
8.1.220.0030.00617.77
8.1.210.0050.00318.77
8.1.200.0030.00617.35
8.1.190.0000.00817.35
8.1.180.0110.00619.52
8.1.170.0100.00719.52
8.1.160.0090.00919.52
8.1.150.0090.00919.52
8.1.140.0080.00819.52
8.1.130.0050.01419.52
8.1.120.0120.00619.52
8.1.110.0090.00919.52
8.1.100.0150.00019.52
8.1.90.0110.00719.52
8.1.80.0080.01119.52
8.1.70.0110.00719.52
8.1.60.0120.00919.52
8.1.50.0150.00319.52
8.1.40.0170.00219.52
8.1.30.0120.00619.52
8.1.20.0120.00819.52
8.1.10.0220.00019.52
8.1.00.0180.00419.52
8.0.300.0000.00819.86
8.0.290.0040.00416.75
8.0.280.0160.00019.52
8.0.270.0160.00319.52
8.0.260.0140.00519.52
8.0.250.0190.00019.52
8.0.240.0210.00419.52
8.0.230.0070.01419.52
8.0.220.0200.00019.52
8.0.210.0040.01519.52
8.0.200.0160.00319.52
8.0.190.0150.00619.52
8.0.180.0160.00419.52
8.0.170.0100.01019.52
8.0.160.0180.00419.52
8.0.150.0080.01219.52
8.0.140.0200.00019.52
8.0.130.0160.00619.52
8.0.120.0100.01019.52
8.0.110.0180.00019.52
8.0.100.0120.00819.52
8.0.90.0210.00019.52
8.0.80.0110.01319.52
8.0.70.0110.01119.52
8.0.60.0200.00019.52
8.0.50.0140.00419.52
8.0.30.0140.00719.52
8.0.20.0150.00619.52
8.0.10.0120.00719.52

preferences:
29.5 ms | 403 KiB | 5 Q