3v4l.org

run code in 300+ PHP versions simultaneously
<style> ul{ list-style: none; } li { position: relative; margin-left: -15px; list-style: none; } </style><?php $arr = array ( '192.168.10.216' => '192.168.40.103', '192.168.10.217' => '192.168.10.216', '192.168.10.88' => '192.168.10.216', '192.168.40.102' => NULL, '192.168.40.103' => '192.168.40.102', '192.168.40.104' => '192.168.40.102' ); function parseTree($tree, $root = null) { $return = array(); # Traverse the tree and search for direct children of the root foreach($tree as $child => $parent) { # A direct child is found if($parent == $root) { # Remove item from tree (we don't need to traverse this again) unset($tree[$child]); # Append the child into result array and parse its children $return[] = array( 'name' => $child, 'children' => parseTree($tree, $child) ); } } return empty($return) ? null : $return; } function printtree($tree) { if(!is_null($tree) && count($tree) > 0) { echo '<ul>'; foreach($tree as $b) { echo '<li>'.$b['name']; printtree($b['children']); echo '</li>'; } echo '</ul>'; } } printtree(parseTree($arr));

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.3.60.0110.00418.56
8.3.50.0140.00722.06
8.3.40.0040.01118.87
8.3.30.0120.00319.22
8.3.20.0080.00020.13
8.3.10.0000.00820.64
8.3.00.0000.00817.50
8.2.180.0060.01016.88
8.2.170.0140.00322.96
8.2.160.0080.00520.36
8.2.150.0080.00024.18
8.2.140.0060.00324.66
8.2.130.0050.00326.16
8.2.120.0040.00422.24
8.2.110.0060.00320.47
8.2.100.0100.00018.22
8.2.90.0050.00219.34
8.2.80.0000.00817.97
8.2.70.0000.00817.49
8.2.60.0060.00318.04
8.2.50.0060.00318.07
8.2.40.0000.00818.20
8.2.30.0000.00819.28
8.2.20.0000.00817.83
8.2.10.0060.00318.03
8.2.00.0040.00417.78
8.1.280.0120.00325.92
8.1.270.0030.00524.02
8.1.260.0040.00426.35
8.1.250.0050.00328.09
8.1.240.0030.00623.90
8.1.230.0080.00319.01
8.1.220.0060.00317.75
8.1.210.0050.00318.77
8.1.200.0090.00017.25
8.1.190.0040.00417.23
8.1.180.0050.00218.10
8.1.170.0060.00318.66
8.1.160.0000.00721.89
8.1.150.0000.00718.90
8.1.140.0070.00017.53
8.1.130.0000.00817.82
8.1.120.0070.00017.39
8.1.110.0040.00417.52
8.1.100.0040.00417.47
8.1.90.0000.00717.50
8.1.80.0070.00017.46
8.1.70.0070.00017.48
8.1.60.0090.00017.63
8.1.50.0030.00517.54
8.1.40.0050.00317.60
8.1.30.0030.00617.66
8.1.20.0030.00517.73
8.1.10.0030.00517.58
8.1.00.0040.00417.42
8.0.300.0000.00718.77
8.0.290.0040.00416.63
8.0.280.0030.00318.48
8.0.270.0000.00816.72
8.0.260.0030.00317.20
8.0.250.0070.00016.98
8.0.240.0000.00716.87
8.0.230.0000.00717.01
8.0.220.0030.00316.85
8.0.210.0070.00016.78
8.0.200.0030.00316.86
8.0.190.0050.00317.02
8.0.180.0000.00816.78
8.0.170.0050.00316.94
8.0.160.0000.00716.83
8.0.150.0040.00416.76
8.0.140.0040.00416.94
8.0.130.0040.00413.36
8.0.120.0000.00716.91
8.0.110.0000.00816.93
8.0.100.0000.00816.86
8.0.90.0040.00416.95
8.0.80.0070.01016.90
8.0.70.0000.00816.79
8.0.60.0040.00417.01
8.0.50.0040.00417.00
8.0.30.0060.01317.03
8.0.20.0150.00717.40
8.0.10.0050.00316.86
8.0.00.0080.01216.80
7.4.330.0050.00015.05
7.4.320.0000.00616.55
7.4.300.0000.00716.48
7.4.290.0000.00716.55
7.4.280.0040.00416.56
7.4.270.0050.00216.52
7.4.260.0060.00316.54
7.4.250.0080.00016.50
7.4.240.0020.00516.58
7.4.230.0030.00316.39
7.4.220.0090.00916.52
7.4.210.0060.00916.57
7.4.200.0070.00016.63
7.4.160.0170.00016.59
7.4.150.0110.00717.40
7.4.140.0120.00417.86
7.4.130.0100.00916.59
7.4.120.0110.00716.52
7.4.110.0100.00716.50
7.4.100.0080.00916.58
7.4.90.0070.01016.42
7.4.80.0060.01818.80
7.4.70.0040.01416.58
7.4.60.0090.01216.57
7.4.50.0000.00816.61
7.4.40.0030.01416.50
7.4.30.0160.00616.74
7.4.10.0110.00714.86
7.4.00.0080.00915.09
7.3.330.0050.00013.35
7.3.320.0000.00513.20
7.3.310.0000.00616.40
7.3.300.0000.00716.25
7.3.290.0100.01016.39
7.3.280.0100.00616.36
7.3.270.0070.01117.40
7.3.260.0120.00616.69
7.3.250.0120.00616.41
7.3.240.0150.00316.54
7.3.230.0030.01316.43
7.3.210.0050.01316.57
7.3.200.0070.01019.39
7.3.190.0090.01116.43
7.3.180.0150.00316.32
7.3.170.0140.00616.64
7.3.160.0040.01216.41
7.3.130.0030.01314.75
7.3.120.0090.00914.74
7.3.110.0100.01015.03
7.3.100.0090.00614.91
7.3.90.0100.00714.76
7.3.80.0100.00615.11
7.3.70.0040.01114.79
7.3.60.0130.00014.92
7.3.50.0030.00914.77
7.3.40.0100.00314.91
7.3.30.0040.00815.04
7.3.20.0080.00416.44
7.3.10.0060.00916.56
7.3.00.0120.00316.75
7.2.330.0090.00916.80
7.2.320.0120.00916.50
7.2.310.0090.00916.77
7.2.300.0100.00716.81
7.2.290.0040.01216.83
7.2.260.0090.00615.04
7.2.250.0040.01515.09
7.2.240.0030.01315.14
7.2.230.0080.01115.09
7.2.220.0130.00315.03
7.2.210.0110.00715.12
7.2.200.0150.00315.31
7.2.190.0030.01014.98
7.2.180.0110.00714.96
7.2.170.0090.00615.32
7.2.160.0070.01015.00
7.2.150.0070.00317.07
7.2.140.0130.00317.00
7.2.130.0000.01516.89
7.2.120.0100.00616.78
7.2.110.0060.01016.84
7.2.100.0060.00916.69
7.2.90.0060.01016.78
7.2.80.0140.00616.74
7.2.70.0090.00417.01
7.2.60.0070.00916.94
7.2.50.0060.00917.05
7.2.40.0060.00916.93
7.2.30.0080.00416.66
7.2.20.0100.00316.58
7.2.10.0070.00716.98
7.2.00.0030.01118.31
7.1.330.0030.00715.94
7.1.320.0040.01215.89
7.1.310.0070.00716.03
7.1.300.0060.01215.77
7.1.290.0120.00315.97
7.1.280.0030.01215.88
7.1.270.0030.01315.63
7.1.260.0060.00915.84
7.1.250.0000.01515.71
7.1.240.0070.00315.86
7.1.230.0070.01115.70
7.1.220.0000.01915.67
7.1.210.0000.01415.64
7.1.200.0070.00415.72
7.1.190.0000.01015.83
7.1.180.0030.00615.68
7.1.170.0050.00515.68
7.1.160.0090.00615.74
7.1.150.0030.00916.02
7.1.140.0100.00715.46
7.1.130.0070.00415.91
7.1.120.0040.00715.79
7.1.110.0110.00415.62
7.1.100.0080.00516.85
7.1.90.0030.01015.84
7.1.80.0070.00715.81
7.1.70.0110.00216.50
7.1.60.0030.01417.53
7.1.50.0110.00816.20
7.1.40.0110.00315.58
7.1.30.0040.00815.96
7.1.20.0040.01115.59
7.1.10.0040.00815.80
7.1.00.0030.04019.16
7.0.330.0120.00015.46
7.0.320.0030.01415.52
7.0.310.0090.00315.54
7.0.300.0030.01315.43
7.0.290.0050.00515.36
7.0.280.0060.00615.43
7.0.270.0040.01115.57
7.0.260.0000.01115.11
7.0.250.0070.00715.49
7.0.240.0130.00015.59
7.0.230.0040.00815.27
7.0.220.0060.00315.32
7.0.210.0040.00915.45
7.0.200.0030.00815.98
7.0.190.0070.00715.46
7.0.180.0030.00715.65
7.0.170.0040.00815.56
7.0.160.0120.00315.31
7.0.150.0070.00315.56
7.0.140.0010.03818.85
7.0.130.0030.01315.29
7.0.120.0040.03618.72
7.0.110.0080.03518.84
7.0.100.0070.03918.83
7.0.90.0020.04318.91
7.0.80.0100.03518.70
7.0.70.0020.03418.77
7.0.60.0030.03118.74
7.0.50.0060.03818.67
7.0.40.0090.03317.69
7.0.30.0050.04317.86
7.0.20.0050.03617.71
7.0.10.0020.03917.73
7.0.00.0040.02817.79
5.6.400.0100.00314.36
5.6.390.0000.01114.46
5.6.380.0030.00914.43
5.6.370.0030.01414.53
5.6.360.0060.01014.66
5.6.350.0060.00914.88
5.6.340.0000.01414.77
5.6.330.0060.00314.88
5.6.320.0070.00714.32
5.6.310.0110.00414.11
5.6.300.0000.00914.25
5.6.290.0000.01314.15
5.6.280.0030.04117.76
5.6.270.0150.00014.45
5.6.260.0040.03517.67
5.6.250.0030.03817.96
5.6.240.0000.04417.64
5.6.230.0080.03817.65
5.6.220.0020.04217.70
5.6.210.0030.04317.61
5.6.200.0050.04317.64
5.6.190.0080.02717.59
5.6.180.0080.03717.87
5.6.170.0000.03417.52
5.6.160.0050.03717.73
5.6.150.0060.02817.71
5.6.140.0070.03217.59
5.6.130.0070.04017.88
5.6.120.0050.04117.67
5.6.110.0030.02717.66
5.6.100.0030.02117.73
5.6.90.0000.04417.65
5.6.80.0070.03717.52
5.6.70.0050.03317.37
5.6.60.0080.03217.46
5.6.50.0050.03917.41
5.6.40.0060.03317.22
5.6.30.0080.03717.29
5.6.20.0050.03517.26
5.6.10.0070.02517.48
5.6.00.0090.01517.19
5.5.380.0000.03716.09
5.5.370.0020.03016.04
5.5.360.0080.03515.83
5.5.350.0030.03515.90
5.5.340.0040.04016.20
5.5.330.0070.03516.35
5.5.320.0060.03916.27
5.5.310.0040.03816.45
5.5.300.0110.03216.40
5.5.290.0060.03816.20
5.5.280.0030.03516.32
5.5.270.0050.03216.11
5.5.260.0050.03516.16
5.5.250.0050.02816.01
5.5.240.0020.03516.01
5.5.230.0030.04216.04
5.5.220.0030.03815.78
5.5.210.0000.04115.94
5.5.200.0060.03215.61
5.5.190.0070.03316.06
5.5.180.0070.03515.99
5.5.170.0070.01014.27
5.5.160.0030.01815.90
5.5.150.0060.01815.96
5.5.140.0040.01615.85
5.5.130.0030.02816.02
5.5.120.0050.03115.89
5.5.110.0030.02515.95
5.5.100.0030.03915.90
5.5.90.0020.03415.88
5.5.80.0050.03015.80
5.5.70.0030.02315.88
5.5.60.0020.02215.71
5.5.50.0040.02015.94
5.5.40.0050.03315.85
5.5.30.0020.04015.84
5.5.20.0020.02815.92
5.5.10.0070.01715.76
5.5.00.0050.03515.77
5.4.450.0020.04015.34
5.4.440.0070.03015.27
5.4.430.0000.02915.27
5.4.420.0020.02515.30
5.4.410.0030.02315.31
5.4.400.0060.03515.13
5.4.390.0050.02415.00
5.4.380.0040.03515.23
5.4.370.0010.03615.17
5.4.360.0050.03615.08
5.4.350.0060.03615.32
5.4.340.0020.04014.98
5.4.330.0000.01511.52
5.4.320.0080.01715.23
5.4.310.0060.01615.10
5.4.300.0050.02615.30
5.4.290.0020.01915.31
5.4.280.0050.02515.16
5.4.270.0020.02515.12
5.4.260.0020.01915.10
5.4.250.0060.03315.11
5.4.240.0020.02415.21
5.4.230.0000.02315.10
5.4.220.0020.01915.05
5.4.210.0050.01515.14
5.4.200.0060.03515.09
5.4.190.0070.03215.19
5.4.180.0050.02315.18
5.4.170.0020.01715.08
5.4.160.0080.03315.14
5.4.150.0040.03814.93
5.4.140.0000.02613.95
5.4.130.0040.01614.03
5.4.120.0050.02313.91
5.4.110.0030.03213.93
5.4.100.0040.02413.82
5.4.90.0070.03013.85
5.4.80.0030.02713.94
5.4.70.0030.03613.83
5.4.60.0030.03213.75
5.4.50.0020.03613.94
5.4.40.0030.03714.01
5.4.30.0050.03213.76
5.4.20.0050.03213.80
5.4.10.0030.03813.97
5.4.00.0040.02713.43
5.3.290.0000.04314.53
5.3.280.0030.02714.71
5.3.270.0000.03314.75
5.3.260.0030.06714.59
5.3.250.0070.05714.61
5.3.240.0000.05714.61
5.3.230.0000.03014.60
5.3.220.0030.02714.43
5.3.210.0030.03014.71
5.3.200.0000.04714.55
5.3.190.0070.06014.52
5.3.180.0030.06014.60
5.3.170.0100.06014.59
5.3.160.0070.05314.55
5.3.150.0030.06014.59
5.3.140.0030.06014.70
5.3.130.0000.07314.70
5.3.120.0000.06714.55
5.3.110.0000.05714.57
5.3.100.0000.06714.13
5.3.90.0000.05014.06
5.3.80.0000.04014.09
5.3.70.0070.06014.26
5.3.60.0030.05714.24
5.3.50.0000.06014.02
5.3.40.0030.05314.10
5.3.30.0000.04013.91
5.3.20.0100.05313.71
5.3.10.0000.06713.69
5.3.00.0070.06313.66
5.2.170.0030.04311.66
5.2.160.0030.05011.66
5.2.150.0030.05711.66
5.2.140.0000.04711.66
5.2.130.0000.05011.66
5.2.120.0000.05311.66
5.2.110.0030.04711.66
5.2.100.0030.05311.66
5.2.90.0030.04011.66
5.2.80.0000.05711.66
5.2.70.0030.05711.66
5.2.60.0000.04011.66
5.2.50.0030.05311.66
5.2.40.0000.05311.66
5.2.30.0100.04711.66
5.2.20.0000.05711.66
5.2.10.0000.05711.66
5.2.00.0000.05711.66
5.1.60.0030.04711.66
5.1.50.0000.04311.66
5.1.40.0030.04311.66
5.1.30.0000.05311.66
5.1.20.0030.04011.66
5.1.10.0030.04011.66
5.1.00.0000.03311.66
5.0.50.0000.03311.66
5.0.40.0030.03011.66
5.0.30.0030.05011.66
5.0.20.0000.03311.66
5.0.10.0000.04011.66
5.0.00.0030.05011.66
4.4.90.0000.02711.66
4.4.80.0000.02711.66
4.4.70.0000.02711.66
4.4.60.0000.03011.66
4.4.50.0000.03011.66
4.4.40.0000.05011.66
4.4.30.0030.02311.66
4.4.20.0000.03011.66
4.4.10.0000.03011.66
4.4.00.0030.04311.66
4.3.110.0030.03011.66
4.3.100.0000.03011.66
4.3.90.0070.02311.66
4.3.80.0000.04011.66
4.3.70.0000.02711.66
4.3.60.0000.02311.66
4.3.50.0000.03011.66
4.3.40.0000.04011.66
4.3.30.0000.02011.66
4.3.20.0000.01711.66
4.3.10.0000.01311.66
4.3.00.0000.01311.66

preferences:
43.14 ms | 401 KiB | 5 Q