3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array ( array( 'id' => '2', 'name' => 'Item2', 'children' => array( array( 'id' => '1', 'name' => 'Item1', 'children' => array( array('id' => '5', 'name' => 'Item5') ) ), array( 'id' => '4', 'name' => 'Item4' ) ) ), array( 'id' => '3', 'name' => 'Item3' ) ); function list_items($array, $parent = 0) { $output = array(); foreach ($array as $arr) { $output[] = array('id' => $arr['id'], 'name' => $arr['name'], 'parent' => $parent); if (is_array($arr['children'] ?? NULL)) { $output = array_merge($output, list_items($arr['children'], $arr['id'])); } } return $output; } $items = list_items($array); print_r($items);

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.4.10.0060.00319.59
8.3.140.0000.00816.75
8.3.130.0080.00018.25
8.3.120.0050.00520.86
8.3.110.0060.00320.94
8.3.100.0080.00016.78
8.3.90.0050.01416.67
8.3.80.0060.00318.31
8.3.70.0040.01116.48
8.3.60.0120.00318.56
8.3.50.0150.00724.50
8.3.40.0140.00018.66
8.3.30.0090.00618.86
8.3.20.0040.00421.73
8.3.10.0080.00021.88
8.3.00.0080.00021.51
8.2.260.0120.00318.93
8.2.250.0100.00717.17
8.2.240.0030.00717.22
8.2.230.0080.00022.58
8.2.220.0030.00624.06
8.2.210.0080.00026.77
8.2.200.0090.00016.63
8.2.190.0090.00916.63
8.2.180.0120.01218.54
8.2.170.0110.00322.96
8.2.160.0110.00322.08
8.2.150.0080.00024.18
8.2.140.0070.00024.66
8.2.130.0070.00026.16
8.2.120.0120.00319.25
8.2.110.0180.00320.52
8.2.100.0040.00819.58
8.2.90.0000.00819.24
8.2.80.0040.00417.97
8.2.70.0060.00317.75
8.2.60.0030.00517.93
8.2.50.0060.00318.07
8.2.40.0030.00618.29
8.2.30.0050.00318.13
8.2.20.0050.00318.20
8.2.10.0000.00719.39
8.2.00.0040.00419.38
8.1.310.0040.00418.51
8.1.300.0050.00316.03
8.1.290.0100.00018.88
8.1.280.0070.00725.92
8.1.270.0100.01020.27
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00623.98
8.1.230.0080.00320.95
8.1.220.0000.00817.79
8.1.210.0040.00418.77
8.1.200.0030.00617.22
8.1.190.0030.00517.23
8.1.180.0040.00418.10
8.1.170.0000.00818.64
8.1.160.0080.00018.77
8.1.150.0040.00418.90
8.1.140.0040.00418.78
8.1.130.0040.00420.16
8.1.120.0070.00017.49
8.1.110.0080.00017.32
8.1.100.0000.00717.47
8.1.90.0040.00417.37
8.1.80.0000.00817.34
8.1.70.0000.00717.45
8.1.60.0040.00417.64
8.1.50.0000.00817.44
8.1.40.0040.00417.44
8.1.30.0000.00817.57
8.1.20.0080.00017.68
8.1.10.0000.00717.48
8.1.00.0060.00317.47
8.0.300.0000.00718.77
8.0.290.0050.00316.75
8.0.280.0000.00718.44
8.0.270.0030.00318.02
8.0.260.0030.00318.46
8.0.250.0070.00017.02
8.0.240.0030.00316.94
8.0.230.0040.00416.93
8.0.220.0000.00716.93
8.0.210.0030.00316.94
8.0.200.0000.00816.93
8.0.190.0000.00716.98
8.0.180.0040.00416.93
8.0.170.0040.00416.95
8.0.160.0070.00016.82
8.0.150.0000.00816.87
8.0.140.0050.00316.87
8.0.130.0050.00013.38
8.0.120.0040.00416.90
8.0.110.0000.00716.75
8.0.100.0040.00416.90
8.0.90.0090.00016.92
8.0.80.0090.00916.88
8.0.70.0040.00416.85
8.0.60.0000.00716.95
8.0.50.0040.00416.75
8.0.30.0070.01017.04
8.0.20.0130.01416.91
8.0.10.0040.00417.01
8.0.00.0090.00916.65
7.4.330.0000.00515.55
7.4.320.0060.00016.44
7.4.300.0000.00616.56
7.4.290.0030.00316.64
7.4.280.0030.00616.61
7.4.270.0050.00316.38
7.4.260.0000.00613.30
7.4.250.0070.00016.63
7.4.240.0000.00816.60
7.4.230.0000.00716.51
7.4.220.0040.00316.51
7.4.210.0080.00816.56
7.4.200.0040.00416.59
7.4.130.0130.00516.38
7.4.120.0070.01316.59
7.4.110.0040.01216.50
7.4.100.0080.00816.61
7.4.90.0070.01016.54
7.4.80.0210.00617.89
7.4.70.0200.00616.46
7.4.60.0160.01016.38
7.4.50.0160.01016.44
7.4.40.0140.01416.61
7.4.30.0190.00816.49
7.4.20.0120.01016.51
7.4.10.0200.00616.51
7.4.00.0140.00616.45
7.3.330.0070.00016.40
7.3.320.0030.00313.20
7.3.310.0070.00016.37
7.3.300.0040.00416.34
7.3.290.0070.00716.33
7.3.280.0030.01516.38
7.3.260.0080.01516.33
7.3.240.0120.00516.37
7.3.230.0060.01016.33
7.3.210.0130.00316.66
7.3.200.0220.01716.28
7.3.190.0140.01416.41
7.3.180.0100.01616.48
7.3.170.0160.01216.35
7.3.160.0140.01316.37
7.3.150.0200.00816.30
7.3.140.0200.00916.41
7.3.130.0160.01016.39
7.3.120.0180.00616.32
7.3.110.0190.00716.35
7.3.100.0130.01316.45
7.3.90.0190.00816.41
7.3.80.0190.00616.49
7.3.70.0140.01216.51
7.3.60.0200.00716.38
7.3.50.0150.01216.39
7.3.40.0120.01416.36
7.3.30.0150.00916.57
7.3.20.0170.01016.31
7.3.10.0390.01216.51
7.3.00.0160.01016.45
7.2.330.0060.01116.66
7.2.320.0140.00716.54
7.2.310.0150.01216.55
7.2.300.0130.01216.55
7.2.290.0140.01316.77
7.2.280.0140.01116.61
7.2.270.0150.01216.44
7.2.260.0160.01116.73
7.2.250.0130.01316.66
7.2.240.0240.00716.71
7.2.230.0150.01316.74
7.2.220.0140.01316.67
7.2.210.0180.00716.65
7.2.200.0150.01216.71
7.2.190.0190.00716.65
7.2.180.0150.01116.66
7.2.170.0170.00716.64
7.2.160.0170.01316.55
7.2.150.0190.00816.54
7.2.140.0180.00716.61
7.2.130.0160.01216.71
7.2.120.0180.00816.61
7.2.110.0170.00916.67
7.2.100.0440.01116.62
7.2.90.0200.00616.65
7.2.80.0250.00216.64
7.2.70.0200.01216.71
7.2.60.0190.00816.62
7.2.50.0170.00916.58
7.2.40.0140.01416.74
7.2.30.0130.01216.67
7.2.20.0190.00916.64
7.2.10.0220.00916.63
7.2.00.0120.01516.60
7.1.330.0240.00915.61
7.1.320.0100.01915.56
7.1.310.0300.00315.79
7.1.300.0220.00515.57
7.1.290.0240.00715.62
7.1.280.0190.01015.71
7.1.270.0240.00815.54
7.1.260.0220.00615.46
7.1.250.0160.01215.69
7.1.240.0220.00515.55
7.1.230.0200.00415.55
7.1.220.0220.00715.55
7.1.210.0220.00615.59
7.1.200.0200.00715.46
7.1.190.0250.00315.73
7.1.180.0490.01515.54
7.1.170.0160.01315.40
7.1.160.0210.01315.66
7.1.150.0220.00615.62
7.1.140.0210.01015.67
7.1.130.0230.00815.58
7.1.120.0190.01215.54
7.1.110.0190.01215.45
7.1.100.0180.01115.47
7.1.90.0430.01315.58
7.1.80.0260.00715.51
7.1.70.0220.01015.57
7.1.60.0130.01615.64
7.1.50.0260.00715.48
7.1.40.0230.00815.47
7.1.30.0210.00715.71
7.1.20.0150.01515.61
7.1.10.0230.01215.49
7.1.00.0230.01015.54
7.0.330.0230.00815.08
7.0.320.0170.01415.29
7.0.310.0160.01615.33
7.0.300.0240.00715.10
7.0.290.0260.00215.16
7.0.280.0270.00315.16
7.0.270.0210.01315.22
7.0.260.0250.00715.43
7.0.250.0180.01415.36
7.0.240.0340.01115.24
7.0.230.0230.00615.18
7.0.220.0230.01015.42
7.0.210.0310.00315.23
7.0.200.0160.01315.10
7.0.190.0310.00515.32
7.0.180.0290.00415.30
7.0.170.0290.00615.45
7.0.160.0270.00515.18
7.0.150.0240.00815.38
7.0.140.0300.00015.40
7.0.130.0260.01215.37
7.0.120.0180.01415.38
7.0.110.0330.01715.16
7.0.100.0200.00515.29
7.0.90.0040.01415.29
7.0.80.0110.00615.17
7.0.70.0060.01215.28
7.0.60.0070.01515.21
7.0.50.0130.00515.30
7.0.40.0090.00915.24
7.0.30.0100.01015.20
7.0.20.0140.00715.39
7.0.10.0090.00915.13
7.0.00.0030.01715.16
5.6.400.0260.01215.68
5.6.390.0140.01415.67
5.6.380.0300.00315.81
5.6.370.0170.01115.63
5.6.360.0290.00315.88
5.6.350.0200.01015.77
5.6.340.0200.01015.68
5.6.330.0200.01515.60
5.6.320.0180.01415.74
5.6.310.0140.01415.80
5.6.300.0250.00815.48
5.6.290.0170.01315.70
5.6.280.0230.00815.67
5.6.270.0150.01515.57
5.6.260.0100.01715.59
5.6.250.0110.00715.76
5.6.240.0090.01115.72
5.6.230.0070.01315.63
5.6.220.0080.01115.68
5.6.210.0030.01815.68
5.6.200.0030.01515.71
5.6.190.0070.01015.59
5.6.180.0100.01015.79
5.6.170.0190.00615.95
5.6.160.0110.01015.68
5.6.150.0120.00815.72
5.6.140.0110.00715.88
5.6.130.0030.01515.57
5.6.120.0110.00815.63
5.6.110.0100.00915.55
5.6.100.0090.01515.59
5.6.90.0110.00715.55
5.6.80.0080.01215.57
5.6.70.0120.00615.54
5.6.60.0130.00415.62
5.6.50.0150.00715.38
5.6.40.0000.01915.45
5.6.30.0150.00415.68
5.6.20.0000.01915.47
5.6.10.0070.01115.54
5.6.00.0110.00815.61
5.5.380.0080.02215.60
5.5.370.0200.01115.68
5.5.360.0200.01415.65
5.5.350.0220.01315.46
5.5.340.0210.00715.59
5.5.330.0190.01215.71
5.5.320.0260.00915.70
5.5.310.0260.00415.71
5.5.300.0240.00615.37
5.5.290.0190.01015.71
5.5.280.0210.01215.80
5.5.270.0200.00815.63
5.5.260.0230.01015.80
5.5.250.0160.01315.52
5.5.240.0200.01015.57
5.5.230.0190.01015.66
5.5.220.0270.00315.61
5.5.210.0190.01215.50
5.5.200.0190.01915.37
5.5.190.0100.01715.56
5.5.180.0150.01315.30
5.5.170.0220.01215.49
5.5.160.0180.00915.24
5.5.150.0160.01615.62
5.5.140.0180.01215.32
5.5.130.0240.01415.51
5.5.120.0200.01015.80
5.5.110.0210.00915.57
5.5.100.0240.00315.55
5.5.90.0210.00615.43
5.5.80.0180.00715.41
5.5.70.0100.01815.63
5.5.60.0220.00815.29
5.5.50.0210.00615.65
5.5.40.0190.01215.61
5.5.30.0110.01715.29
5.5.20.0250.00315.52
5.5.10.0180.00915.55
5.5.00.0130.01315.46
5.4.450.0130.01312.50
5.4.440.0170.00612.56
5.4.430.0180.00912.47
5.4.420.0150.00712.29
5.4.410.0150.00612.45
5.4.400.0160.00612.31
5.4.390.0160.00512.19
5.4.380.0190.00312.37
5.4.370.0070.01412.48
5.4.360.0180.00312.21
5.4.350.0150.00612.39
5.4.340.0150.00912.30
5.4.330.0220.00312.58
5.4.320.0160.00812.48
5.4.310.0130.01312.39
5.4.300.0260.00312.35
5.4.290.0210.00312.29
5.4.280.0090.01612.38
5.4.270.0110.01112.37
5.4.260.0170.00612.39
5.4.250.0210.00012.36
5.4.240.0170.00712.37
5.4.230.0170.00712.22
5.4.220.0140.00712.25
5.4.210.0120.01512.27
5.4.200.0180.00412.25
5.4.190.0170.00612.49
5.4.180.0100.01412.39
5.4.170.0200.00412.28
5.4.160.0160.00612.27
5.4.150.0160.00712.36
5.4.140.0180.00412.63
5.4.130.0120.00912.38
5.4.120.0140.00712.27
5.4.110.0140.00612.65
5.4.100.0160.00612.51
5.4.90.0070.01412.24
5.4.80.0130.00812.41
5.4.70.0150.00612.46
5.4.60.0140.00712.41
5.4.50.0130.00712.41
5.4.40.0140.00912.41
5.4.30.0060.01312.45
5.4.20.0170.00412.57
5.4.10.0170.00312.35
5.4.00.0160.00612.32
5.3.290.0130.01712.77
5.3.280.0100.01312.80
5.3.270.0150.00912.88
5.3.260.0080.01512.88
5.3.250.0250.00012.85
5.3.240.0110.01512.78
5.3.230.0200.00312.95
5.3.220.0080.01412.64
5.3.210.0070.01512.81
5.3.200.0090.01312.68
5.3.190.0140.01012.82
5.3.180.0180.00412.83
5.3.170.0160.01012.83
5.3.160.0140.00712.85
5.3.150.0160.00613.00
5.3.140.0140.00712.81
5.3.130.0140.00813.05
5.3.120.0160.00812.78
5.3.110.0090.01312.90
5.3.100.0150.00612.82
5.3.90.0170.00412.84
5.3.80.0150.00512.86
5.3.70.0220.00412.87
5.3.60.0120.00912.84
5.3.50.0120.01212.81
5.3.40.0090.01412.73
5.3.30.0140.00712.88
5.3.20.0130.01212.84
5.3.10.0110.01112.43
5.3.00.0140.00812.64
5.2.170.0120.00611.92
5.2.160.0130.00511.92
5.2.150.0150.00711.94
5.2.140.0140.00611.91
5.2.130.0130.00711.87
5.2.120.0080.01212.01
5.2.110.0100.00811.87
5.2.100.0130.01011.87
5.2.90.0120.00612.02
5.2.80.0120.00811.95
5.2.70.0180.00011.87
5.2.60.0160.00311.87
5.2.50.0160.00611.87
5.2.40.0100.01011.87
5.2.30.0180.00311.87
5.2.20.0120.00811.87
5.2.10.0200.00311.87
5.2.00.0090.01211.87
5.1.60.0120.00511.87
5.1.50.0150.00611.87
5.1.40.0120.00911.87
5.1.30.0130.00811.87
5.1.20.0130.00511.87
5.1.10.0130.00311.87
5.1.00.0080.00811.87
5.0.50.0090.00611.87
5.0.40.0120.00311.87
5.0.30.0060.00811.87
5.0.20.0160.00311.87
5.0.10.0090.00611.87
5.0.00.0040.00911.87
4.4.90.0070.00211.87
4.4.80.0020.00711.87
4.4.70.0040.00411.87
4.4.60.0050.00511.87
4.4.50.0040.00411.87
4.4.40.0090.00011.87
4.4.30.0040.00811.87
4.4.20.0090.00011.87
4.4.10.0060.00311.87
4.4.00.0120.00011.87
4.3.110.0040.00411.87
4.3.100.0060.00311.87
4.3.90.0050.00511.87
4.3.80.0090.00011.87
4.3.70.0080.00211.87
4.3.60.0110.00011.87
4.3.50.0050.00511.87
4.3.40.0050.00511.87
4.3.30.0070.00011.87
4.3.20.0050.00311.87
4.3.10.0030.00711.87
4.3.00.0040.00411.87

preferences:
33.19 ms | 403 KiB | 5 Q