3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ [ 'id' => 1, 'parent_id' => 0, 'access_type' => 'full-access', 'child' => [ [ 'id' => 4, 'parent_id' => 1, 'access_type' => '', ], [ 'id' => 5, 'parent_id' => 1, 'access_type' => '', ], ], ], [ 'id' => 2, 'parent_id' => 0, 'access_type' => 'read', 'child' => [ [ 'id' => 10, 'parent_id' => 2, 'access_type' => 'read-write', 'child' => [ [ 'id' => 11, 'parent_id' => 10, 'access_type' => '', ], [ 'id' => 12, 'parent_id' => 10, 'access_type' => 'read', ], ], ], [ 'id' => 7, 'parent_id' => 3, 'access_type' => 'read-write', ], ], ], [ 'id' => 3, 'parent_id' => 0, 'access_type' => 'full-access', 'child' => [ [ 'id' => 6, 'parent_id' => 3, 'access_type' => '', 'child' => [ [ 'id' => 8, 'parent_id' => 6, 'access_type' => '', ], [ 'id' => 9, 'parent_id' => 6, 'access_type' => '', ], ], ], [ 'id' => 18, 'parent_id' => 3, 'access_type' => '', ], ], ], [ 'id' => 13, 'parent_id' => 0, 'access_type' => '', 'child' => [ [ 'id' => 14, 'parent_id' => 13, 'access_type' => 'full-access', 'child' => [ [ 'id' => 15, 'parent_id' => 14, 'access_type' => '', ], [ 'id' => 16, 'parent_id' => 14, 'access_type' => '', ], ], ], [ 'id' => 17, 'parent_id' => 13, 'access_type' => '', ], ], ], ]; func_x($arr); function func_x($arr, $level = 0, $parent = '') { foreach($arr as $x) { if( empty ( $x['access_type'] ) && $parent == 'full-access' ) { $x['access_type'] = $parent; } echo str_repeat("---", $level) . " [" . $x['id'] . "] -> " . $x['access_type'] . "\n"; if(!empty($x['child'])) { func_x($x['child'], $level+1, $x['access_type']); } } }

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.0160.01320.18
8.4.150.0020.00114.05
8.4.140.0100.01317.46
8.4.130.0110.00818.67
8.4.120.0090.01123.92
8.4.110.0070.00222.66
8.4.100.0130.00918.82
8.4.90.0090.00418.68
8.4.80.0150.00518.71
8.4.70.0070.00617.89
8.4.60.0100.01019.18
8.4.50.0110.00918.81
8.4.40.0120.00319.21
8.4.30.0120.00918.60
8.4.20.0170.00318.75
8.4.10.0030.00617.84
8.3.280.0170.00818.35
8.3.270.0080.01116.83
8.3.260.0120.00816.77
8.3.250.0120.00818.80
8.3.240.0090.01017.23
8.3.230.0140.00616.72
8.3.220.0110.00818.91
8.3.210.0100.00916.59
8.3.200.0040.00416.63
8.3.190.0060.00317.13
8.3.180.0040.00516.73
8.3.170.0110.00718.96
8.3.160.0080.00020.12
8.3.150.0070.01116.82
8.3.140.0040.00816.99
8.3.130.0000.00816.93
8.3.120.0090.00018.93
8.3.110.0090.00020.94
8.3.100.0080.00016.50
8.3.90.0080.00018.30
8.3.80.0090.00318.43
8.3.70.0040.01116.62
8.3.60.0070.01416.75
8.3.50.0110.00318.19
8.3.40.0070.01018.84
8.3.30.0110.00418.81
8.3.20.0040.00422.27
8.3.10.0070.01121.91
8.3.00.0050.00322.52
8.2.290.0100.00920.56
8.2.280.0070.01018.31
8.2.270.0040.01418.82
8.2.260.0070.01118.40
8.2.250.0000.00818.69
8.2.240.0050.00518.88
8.2.230.0030.00622.58
8.2.220.0040.00437.54
8.2.210.0070.00026.77
8.2.200.0000.01116.88
8.2.190.0110.00716.58
8.2.180.0090.00916.38
8.2.170.0180.00022.96
8.2.160.0100.00320.46
8.2.150.0000.00825.66
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0070.00026.16
8.2.110.0070.00321.04
8.2.100.0060.00617.91
8.2.90.0000.00820.47
8.2.80.0040.00420.50
8.2.70.0000.00817.50
8.2.60.0040.00717.49
8.2.50.0090.00017.63
8.2.40.0030.00619.63
8.2.30.0040.00419.34
8.2.20.0050.00218.16
8.2.10.0040.00419.23
8.2.00.0000.00719.23
8.1.330.0120.00622.23
8.1.320.0120.00816.07
8.1.310.0080.00018.34
8.1.300.0000.00918.38
8.1.290.0030.00718.88
8.1.280.0090.00625.92
8.1.270.0000.00823.99
8.1.260.0020.00526.35
8.1.250.0040.00428.09
8.1.240.0090.00022.20
8.1.230.0100.00320.84
8.1.220.0000.00817.78
8.1.210.0000.00818.95
8.1.200.0060.00317.36
8.1.190.0000.00917.35
8.1.180.0050.00518.10
8.1.170.0050.00317.62
8.1.160.0040.00418.97
8.1.150.0040.00418.85
8.1.140.0000.00720.84
8.1.130.0030.00620.17
8.1.120.0070.00017.37
8.1.110.0000.00717.42
8.1.100.0000.00717.47
8.1.90.0000.00717.44
8.1.80.0030.00517.55
8.1.70.0030.00317.49
8.1.60.0030.00617.47
8.1.50.0080.00017.56
8.1.40.0100.00017.58
8.1.30.0030.00617.70
8.1.20.0060.00317.67
8.1.10.0040.00417.55
8.1.00.0000.00817.43
8.0.300.0000.00720.10
8.0.290.0080.00016.88
8.0.280.0050.00318.47
8.0.270.0030.00316.74
8.0.260.0030.00320.18
8.0.250.0070.00017.00
8.0.240.0000.00716.99
8.0.230.0050.00216.95
8.0.220.0030.00316.95
8.0.210.0000.00816.90
8.0.200.0000.00716.96
8.0.190.0050.00316.90
8.0.180.0000.00816.93
8.0.170.0040.00416.85
8.0.160.0000.00716.97
8.0.150.0000.00716.86
8.0.140.0040.00416.77
8.0.130.0030.00313.34
8.0.120.0070.00016.78
8.0.110.0030.00316.92
8.0.100.0050.00217.02
8.0.90.0040.00416.98
8.0.80.0070.00716.89
8.0.70.0000.00816.86
8.0.60.0040.00416.91
8.0.50.0000.00716.96
8.0.30.0160.00316.77
8.0.20.0140.00716.89
8.0.10.0000.00717.03
8.0.00.0150.00316.80
7.4.330.0000.00516.83
7.4.320.0000.00616.50
7.4.300.0000.00716.64
7.4.290.0030.00516.54
7.4.280.0040.00416.55
7.4.270.0050.00316.54
7.4.260.0000.00513.24
7.4.250.0000.00716.65
7.4.240.0050.00216.58
7.4.230.0070.00016.67
7.4.220.0030.00316.51
7.4.210.0040.01016.63
7.4.200.0040.00416.65
7.4.130.0140.00316.37
7.4.120.0170.00716.55
7.4.110.0170.00716.60
7.4.100.0160.00916.48
7.4.90.0140.00916.61
7.4.80.0170.00817.90
7.4.70.0060.01816.51
7.4.60.0140.01016.48
7.4.50.0100.01216.65
7.4.40.0130.01716.52
7.4.30.0130.02316.41
7.4.20.0240.00316.38
7.4.10.0210.00616.38
7.4.00.0150.00815.74
7.3.330.0020.00516.29
7.3.320.0060.00013.18
7.3.310.0040.00416.29
7.3.300.0030.00316.25
7.3.290.0030.00316.39
7.3.280.0090.01116.40
7.3.260.0110.00816.40
7.3.240.0080.01216.47
7.3.230.0140.01116.53
7.3.220.0260.00616.68
7.3.210.0160.01116.61
7.3.200.0180.00816.37
7.3.190.0190.00516.56
7.3.180.0160.01116.41
7.3.170.0150.00916.53
7.3.160.0120.01116.50
7.3.150.0250.00416.60
7.3.140.0230.00616.30
7.3.130.0250.01416.66
7.3.120.0160.01016.23
7.3.110.0270.00416.39
7.3.100.0240.01316.15
7.3.90.0140.01315.51
7.3.80.0200.00915.60
7.3.70.0170.01115.58
7.3.60.0180.00915.54
7.3.50.0190.00815.65
7.3.40.0210.00915.63
7.3.30.0160.01215.69
7.3.20.0170.01315.85
7.3.10.0250.00515.70
7.3.00.0280.00915.58
7.2.340.0210.00916.84
7.2.330.0110.01316.62
7.2.320.0180.01016.63
7.2.310.0160.00716.54
7.2.300.0190.00716.67
7.2.290.0180.01416.50
7.2.280.0220.00816.77
7.2.270.0130.01316.34
7.2.260.0290.00316.26
7.2.250.0160.01016.44
7.2.240.0170.01316.61
7.2.230.0270.01216.29
7.2.220.0220.00815.82
7.2.210.0160.01215.74
7.2.200.0180.01215.78
7.2.190.0190.01415.64
7.2.180.0160.01415.65
7.2.170.0200.01015.78
7.2.160.0150.01715.99
7.2.150.0290.00715.89
7.2.140.0160.01415.95
7.2.130.0160.01215.88
7.2.120.0220.00715.91
7.2.110.0230.00815.88
7.2.100.0160.01015.81
7.2.90.0190.00815.84
7.2.80.0250.00816.15
7.2.70.0150.01216.00
7.2.60.0150.01015.94
7.2.50.0160.01715.99
7.2.40.0210.00615.88
7.2.30.0130.01416.04
7.2.20.0120.01515.89
7.2.10.0170.00916.00
7.2.00.0200.00515.89
7.1.330.0180.01815.84
7.1.320.0190.00915.60
7.1.310.0180.00715.75
7.1.300.0170.01115.68
7.1.290.0200.00815.63
7.1.280.0220.01014.67
7.1.270.0270.01014.79
7.1.260.0160.01014.71
7.1.250.0110.01214.71
7.1.240.0260.00415.58
7.1.230.0220.01115.57
7.1.220.0240.00715.60
7.1.210.0220.01115.57
7.1.200.0160.01615.47
7.1.190.0280.00715.60
7.1.180.0230.00615.54
7.1.170.0190.00915.50
7.1.160.0130.01315.66
7.1.150.0240.00515.59
7.1.140.0190.01015.52
7.1.130.0270.00515.59
7.1.120.0240.01015.69
7.1.110.0150.01515.60
7.1.100.0190.01115.52
7.1.90.0530.00315.67
7.1.80.0220.01115.55
7.1.70.0250.00715.62
7.1.60.0270.00615.59
7.1.50.0190.01115.60
7.1.40.0250.01015.43
7.1.30.0230.00715.68
7.1.20.0290.00715.55
7.1.10.0280.00615.63
7.1.00.0220.01115.61
7.0.330.0280.00415.20
7.0.320.0230.01015.11
7.0.310.0230.00315.24
7.0.300.0220.00415.36
7.0.290.0130.01315.32
7.0.280.0200.00915.20
7.0.270.0170.01015.30
7.0.260.0200.00915.21
7.0.250.0170.01015.20
7.0.240.0200.01415.46
7.0.230.0170.01415.24
7.0.220.0230.00915.30
7.0.210.0240.00415.14
7.0.200.0290.00015.09
7.0.190.0180.01115.36
7.0.180.0220.00615.36
7.0.170.0180.01515.33
7.0.160.0260.01115.31
7.0.150.0230.00815.34
7.0.140.0200.01015.39
7.0.130.0260.00315.19
7.0.120.0200.01215.30
7.0.110.0550.00615.38
7.0.100.0250.00315.32
7.0.90.0160.01315.19
7.0.80.0180.01015.34
7.0.70.0240.00915.36
7.0.60.0270.00315.40
7.0.50.0170.01015.07
7.0.40.0240.00415.18
7.0.30.0270.00315.38
7.0.20.0230.00515.16
7.0.10.0260.00715.27
7.0.00.0160.01315.20
5.6.400.0220.00916.34
5.6.390.0210.00916.30
5.6.380.0230.01115.84
5.6.370.0110.01915.72
5.6.360.0120.01516.11
5.6.350.0230.00716.04
5.6.340.0250.00316.15
5.6.330.0160.01316.18
5.6.320.0140.01415.84
5.6.310.0180.01215.91
5.6.300.0220.01116.00
5.6.290.0200.01016.11
5.6.280.0180.01416.44
5.6.270.0280.00316.29
5.6.260.0210.01316.10
5.6.250.0240.00716.10
5.6.240.0210.01016.13
5.6.230.0210.01016.04
5.6.220.0220.00915.96
5.6.210.0230.01116.17
5.6.200.0150.01715.89
5.6.190.0170.01415.88
5.6.180.0150.01516.01
5.6.170.0180.01816.00
5.6.160.0210.00915.92
5.6.150.0210.00915.90
5.6.140.0140.01816.11
5.6.130.0230.00615.80
5.6.120.0250.00315.99
5.6.110.0190.01116.24
5.6.100.0180.01216.09
5.6.90.0180.01116.25
5.6.80.0210.00915.82
5.6.70.0170.01715.97
5.6.60.0170.01215.91
5.6.50.0210.01215.98
5.6.40.0300.00316.08
5.6.30.0150.01815.86
5.6.20.0230.00615.79
5.6.10.0220.00616.02
5.6.00.0310.00316.12
5.5.380.0230.00916.21
5.5.370.0210.01116.21
5.5.360.0180.01416.23
5.5.350.0160.01216.18
5.5.340.0310.00016.06
5.5.330.0130.01616.04
5.5.320.0230.00916.17
5.5.310.0160.01615.94
5.5.300.0230.01015.94
5.5.290.0220.00715.91
5.5.280.0220.00815.96
5.5.270.0210.00716.06
5.5.260.0240.00715.78
5.5.250.0240.00716.07
5.5.240.0260.00315.99
5.5.230.0160.01215.86
5.5.220.0190.00915.98
5.5.210.0270.00716.07
5.5.200.0220.00816.07
5.5.190.0120.01615.79
5.5.180.0180.01116.03
5.5.170.0190.01315.88
5.5.160.0160.01616.12
5.5.150.0170.01115.84
5.5.140.0180.00916.00
5.5.130.0220.01216.16
5.5.120.0220.00916.11
5.5.110.0200.01115.71
5.5.100.0160.01216.09
5.5.90.0190.00916.10
5.5.80.0140.01416.08
5.5.70.0210.00916.09
5.5.60.0220.01016.02
5.5.50.0210.00916.08
5.5.40.0220.00716.04
5.5.30.0130.02115.76
5.5.20.0230.01315.76
5.5.10.0280.00615.65
5.5.00.0260.00715.72
5.4.450.0140.00713.27
5.4.440.0190.00413.27
5.4.430.0140.00713.27
5.4.420.0120.00913.27
5.4.410.0150.00713.27
5.4.400.0130.00913.27
5.4.390.0180.00413.27
5.4.380.0140.00713.27
5.4.370.0210.00013.27
5.4.360.0180.00613.27
5.4.350.0130.00813.27
5.4.340.0220.00613.27
5.4.330.0130.01413.27
5.4.320.0240.00413.27
5.4.310.0200.00713.27
5.4.300.0250.00613.27
5.4.290.0160.01013.27
5.4.280.0180.00313.27
5.4.270.0150.00913.27
5.4.260.0210.00713.27
5.4.250.0140.00813.27
5.4.240.0120.01213.27
5.4.230.0160.00913.27
5.4.220.0140.00713.27
5.4.210.0130.01013.27
5.4.200.0180.00413.27
5.4.190.0080.01513.27
5.4.180.0170.00613.27
5.4.170.0140.01413.27
5.4.160.0230.00013.27
5.4.150.0140.01013.27
5.4.140.0130.01013.27
5.4.130.0110.01113.27
5.4.120.0190.00313.27
5.4.110.0170.00713.27
5.4.100.0130.01613.27
5.4.90.0170.00413.27
5.4.80.0120.00913.27
5.4.70.0180.00313.27
5.4.60.0150.00713.27
5.4.50.0160.00913.27
5.4.40.0160.00813.27
5.4.30.0140.00913.27
5.4.20.0180.00313.27
5.4.10.0190.00713.27
5.4.00.0170.00413.27
5.3.290.0160.00813.27
5.3.280.0110.01313.27
5.3.270.0200.00513.27
5.3.260.0150.00913.27
5.3.250.0160.00813.27
5.3.240.0160.00913.27
5.3.230.0140.01413.27
5.3.220.0130.01013.27
5.3.210.0180.00413.27
5.3.200.0200.00513.27
5.3.190.0200.00313.27
5.3.180.0190.00413.27
5.3.170.0170.00613.27
5.3.160.0120.01513.27
5.3.150.0230.00513.27
5.3.140.0160.00813.27
5.3.130.0160.01413.27
5.3.120.0140.01113.27
5.3.110.0160.00713.27
5.3.100.0210.00313.27
5.3.90.0150.00713.27
5.3.80.0180.00813.27
5.3.70.0160.01113.27
5.3.60.0150.00613.27
5.3.50.0110.01113.27
5.3.40.0190.01013.27
5.3.30.0090.01213.27
5.3.20.0190.00713.27
5.3.10.0100.01413.27
5.3.00.0130.00813.27
5.2.170.0140.00513.27
5.2.160.0050.01513.27
5.2.150.0110.00613.27
5.2.140.0140.00713.27
5.2.130.0080.01113.27
5.2.120.0100.01113.27
5.2.110.0110.00713.27
5.2.100.0060.01313.27
5.2.90.0130.00613.27
5.2.80.0140.00413.27
5.2.70.0120.00713.27
5.2.60.0080.01113.27
5.2.50.0160.00313.27
5.2.40.0130.00513.27
5.2.30.0080.01113.27
5.2.20.0110.00713.27
5.2.10.0100.00813.27
5.2.00.0140.00313.27
5.1.60.0050.01113.27
5.1.50.0090.00613.27
5.1.40.0100.00513.27
5.1.30.0060.01213.27
5.1.20.0180.00313.27
5.1.10.0120.00913.27
5.1.00.0150.00713.27
5.0.50.0110.00413.27
5.0.40.0090.00613.27
5.0.30.0110.00213.27
5.0.20.0070.00713.27
5.0.10.0090.00413.27
5.0.00.0090.00413.27
4.4.90.0060.00313.27
4.4.80.0080.00013.27
4.4.70.0060.00313.27
4.4.60.0070.00213.27
4.4.50.0060.00313.27
4.4.40.0030.00613.27
4.4.30.0000.00813.27
4.4.20.0070.00213.27
4.4.10.0110.00013.27
4.4.00.0080.00013.27
4.3.110.0040.00413.27
4.3.100.0050.00313.27
4.3.90.0030.00613.27
4.3.80.0090.00013.27
4.3.70.0000.00813.27
4.3.60.0030.00613.27
4.3.50.0060.00313.27
4.3.40.0000.00913.27
4.3.30.0040.00413.27
4.3.20.0050.00213.27
4.3.10.0050.00313.27
4.3.00.0040.00413.27

preferences:
40.2 ms | 403 KiB | 5 Q