3v4l.org

run code in 300+ PHP versions simultaneously
<?php $category = array( array('left' => 1, 'right' => 11, 'x' => 'A'), array('left' => 2, 'right' => 4, 'x' => 'B'), array('left' => 5, 'right' => 10, 'x' => 'C'), array('left' => 6, 'right' => 7, 'x' => 'D'), array('left' => 8, 'right' => 9, 'x' => 'E'), array('left' => 12, 'right' => 13, 'x' => 'F'), ); function createTree ($category, $left = 0, $right = null) { $tree = array(); foreach ($category as $cat => $data) { if ($data['left'] == $left + 1 && (is_null($right) || $data['right'] < $right)) { $tree[$cat] = createTree($category, $data['left'], $data['right']); $left = $data['right']; } } return $tree; } $tree = createTree ($category); print_r($tree);

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.40.0100.00718.96
8.3.30.0090.00619.04
8.3.20.0050.00220.13
8.3.10.0000.00823.66
8.3.00.0040.00419.59
8.2.170.0030.01322.96
8.2.160.0110.00320.52
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00419.66
8.2.110.0090.00022.20
8.2.100.0130.00019.63
8.2.90.0040.00419.29
8.2.80.0000.00818.05
8.2.70.0030.00517.63
8.2.60.0090.00018.01
8.2.50.0060.00318.07
8.2.40.0040.00418.16
8.2.30.0070.00018.23
8.2.20.0040.00417.81
8.2.10.0040.00417.99
8.2.00.0000.00818.15
8.1.270.0030.00620.24
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00623.63
8.1.230.0080.00418.97
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0000.00917.47
8.1.190.0000.00917.53
8.1.180.0040.00418.73
8.1.170.0040.00418.59
8.1.160.0020.00522.04
8.1.150.0040.00418.69
8.1.140.0000.00817.47
8.1.130.0070.00017.81
8.1.120.0080.00017.38
8.1.110.0000.00817.44
8.1.100.0080.00017.47
8.1.90.0040.00417.39
8.1.80.0030.00617.40
8.1.70.0000.00717.31
8.1.60.0080.00017.54
8.1.50.0030.00617.57
8.1.40.0000.00817.52
8.1.30.0000.00817.61
8.1.20.0040.00417.69
8.1.10.0040.00417.48
8.1.00.0000.00817.39
8.0.300.0080.00018.77
8.0.290.0040.00417.18
8.0.280.0030.00318.41
8.0.270.0000.00717.22
8.0.260.0050.00317.28
8.0.250.0040.00416.99
8.0.240.0030.00316.95
8.0.230.0070.00017.04
8.0.220.0030.00316.81
8.0.210.0070.00016.87
8.0.200.0030.00317.00
8.0.190.0080.00016.98
8.0.180.0000.00716.94
8.0.170.0000.00916.99
8.0.160.0000.00816.95
8.0.150.0000.00716.78
8.0.140.0070.00016.93
8.0.130.0060.00013.34
8.0.120.0040.00416.86
8.0.110.0000.00816.75
8.0.100.0000.00716.96
8.0.90.0040.00416.79
8.0.80.0080.01116.84
8.0.70.0040.00416.91
8.0.60.0040.00416.91
8.0.50.0040.00416.98
8.0.30.0090.00917.07
8.0.20.0140.00817.40
8.0.10.0040.00416.84
8.0.00.0120.00816.90
7.4.330.0000.00515.03
7.4.320.0000.00716.54
7.4.300.0000.00616.61
7.4.290.0070.00016.54
7.4.280.0050.00316.54
7.4.270.0000.00716.56
7.4.260.0080.00016.59
7.4.250.0070.00016.55
7.4.240.0020.00516.50
7.4.230.0030.00316.52
7.4.220.0060.01616.59
7.4.210.0070.01216.58
7.4.200.0000.00716.32
7.4.160.0060.00916.50
7.4.150.0170.00317.40
7.4.140.0090.01117.86
7.4.130.0090.00916.63
7.4.120.0100.00916.68
7.4.110.0060.01216.42
7.4.100.0080.01216.72
7.4.90.0120.00916.69
7.4.80.0050.01419.39
7.4.70.0090.00816.54
7.4.60.0090.00616.43
7.4.50.0040.00416.39
7.4.40.0100.00716.63
7.4.30.0060.01216.53
7.4.10.0130.00315.06
7.4.00.0060.00915.00
7.3.330.0000.00713.17
7.3.320.0000.00613.21
7.3.310.0000.00716.26
7.3.300.0000.00616.30
7.3.290.0040.00416.22
7.3.280.0090.00916.36
7.3.270.0120.00617.40
7.3.260.0120.00416.28
7.3.250.0100.01216.44
7.3.240.0060.01116.29
7.3.230.0040.01516.62
7.3.210.0060.01116.56
7.3.200.0060.00919.39
7.3.190.0130.00716.56
7.3.180.0130.00716.45
7.3.170.0110.00716.57
7.3.160.0110.00616.55
7.3.130.0110.00714.90
7.3.120.0110.00814.74
7.3.110.0070.01014.81
7.3.100.0090.00814.83
7.3.90.0090.00614.91
7.3.80.0020.01114.87
7.3.70.0080.00414.88
7.3.60.0080.00714.81
7.3.50.0060.00714.76
7.3.40.0050.00914.92
7.3.30.0090.00714.81
7.3.20.0060.00816.57
7.3.10.0020.01016.58
7.3.00.0060.00716.67
7.2.330.0080.00816.85
7.2.320.0090.00916.91
7.2.310.0210.00016.68
7.2.300.0100.00716.59
7.2.290.0070.01616.59
7.2.260.0110.00715.07
7.2.250.0100.00915.34
7.2.240.0080.01015.06
7.2.230.0100.00614.99
7.2.220.0030.01115.15
7.2.210.0100.00515.16
7.2.200.0060.01015.22
7.2.190.0070.00715.06
7.2.180.0060.00715.06
7.2.170.0030.01215.13
7.2.160.0060.00915.04
7.2.150.0060.00616.91
7.2.140.0070.00616.81
7.2.130.0030.01017.02
7.2.120.0020.01217.01
7.2.110.0070.00617.02
7.2.100.0060.00717.12
7.2.90.0080.00916.99
7.2.80.0020.01316.98
7.2.70.0090.00617.05
7.2.60.0070.00716.95
7.2.50.0050.00916.97
7.2.40.0050.00716.96
7.2.30.0050.01017.06
7.2.20.0050.00817.03
7.2.10.0030.01016.80
7.2.00.0030.01017.92
7.1.330.0020.01415.82
7.1.320.0070.00815.76
7.1.310.0080.00615.83
7.1.300.0100.00515.90
7.1.290.0020.01315.69
7.1.280.0050.00815.88
7.1.270.0060.00915.85
7.1.260.0080.00615.67
7.1.250.0040.00915.92
7.1.240.0080.00115.64
7.1.230.0080.00815.84
7.1.220.0010.01015.69
7.1.210.0060.00815.70
7.1.200.0050.00915.71
7.1.190.0020.00815.93
7.1.180.0020.01215.93
7.1.170.0070.00715.85
7.1.160.0060.00615.89
7.1.150.0050.00715.87
7.1.140.0070.00715.86
7.1.130.0070.00515.86
7.1.120.0040.00715.81
7.1.110.0070.00915.71
7.1.100.0060.00616.60
7.1.90.0060.00715.88
7.1.80.0070.00715.73
7.1.70.0030.01016.32
7.1.60.0030.01317.04
7.1.50.0040.00916.29
7.1.40.0060.00615.90
7.1.30.0050.00915.75
7.1.20.0050.00915.70
7.1.10.0030.00915.77
7.1.00.0010.03417.98
7.0.330.0020.01115.30
7.0.320.0040.00615.40
7.0.310.0100.00415.35
7.0.300.0050.00815.36
7.0.290.0050.00815.24
7.0.280.0080.00915.39
7.0.270.0060.00915.31
7.0.260.0020.01115.46
7.0.250.0040.00815.54
7.0.240.0070.00815.35
7.0.230.0050.01015.41
7.0.220.0090.00615.42
7.0.210.0020.01115.35
7.0.200.0070.00415.87
7.0.190.0120.00515.34
7.0.180.0080.01015.63
7.0.170.0110.00615.43
7.0.160.0060.00515.19
7.0.150.0050.00815.39
7.0.140.0070.00615.55
7.0.130.0090.00615.60
7.0.120.0070.00915.44
7.0.110.0030.01115.42
7.0.100.0060.00915.38
7.0.90.0110.00315.09
7.0.80.0080.00815.45
7.0.70.0070.00715.41
7.0.60.0060.01717.07
7.0.50.0090.02116.16
7.0.40.0090.02715.76
7.0.30.0250.02615.70
7.0.20.0080.03115.71
7.0.10.0040.02215.72
7.0.00.0100.02015.76
5.6.400.0070.00714.68
5.6.390.0060.00914.39
5.6.380.0060.00714.50
5.6.370.0050.00914.47
5.6.360.0080.00514.35
5.6.350.0060.00814.34
5.6.340.0090.00914.32
5.6.330.0060.00814.33
5.6.320.0040.01214.38
5.6.310.0030.01214.76
5.6.300.0060.01014.64
5.6.290.0080.00714.50
5.6.280.0040.02916.63
5.6.270.0080.00814.64
5.6.260.0020.01314.56
5.6.250.0030.01314.43
5.6.240.0030.01114.59
5.6.230.0040.00514.42
5.6.220.0090.00414.35
5.6.210.0070.03316.50
5.6.200.0090.01515.59
5.6.190.0030.02316.50
5.6.180.0080.01916.58
5.6.170.0070.02316.47
5.6.160.0060.03216.45
5.6.150.0090.02215.63
5.6.140.0050.02015.85
5.6.130.0010.02315.69
5.6.120.0070.01816.57
5.6.110.0120.02516.65
5.6.100.0050.03716.71
5.6.90.0060.03616.61
5.6.80.0080.02916.49
5.6.70.0080.00514.43
5.6.60.0050.01014.17
5.6.50.0110.00714.29
5.6.40.0030.00914.20
5.6.30.0070.00914.32
5.6.20.0090.00714.57
5.6.10.0060.00614.48
5.6.00.0070.01014.37
5.5.380.0100.00514.39
5.5.370.0060.00714.35
5.5.360.0070.00814.30
5.5.350.0040.03416.48
5.5.340.0010.02615.76
5.5.330.0060.01916.46
5.5.320.1350.01716.38
5.5.310.0100.02716.31
5.5.300.0070.01815.54
5.5.290.0020.02415.67
5.5.280.0090.03316.53
5.5.270.0110.01916.50
5.5.260.0090.03216.60
5.5.250.0070.03316.31
5.5.240.0070.02816.37
5.5.230.0080.00514.22
5.5.220.0070.00814.40
5.5.210.0080.00614.38
5.5.200.0070.00614.31
5.5.190.0090.00714.23
5.5.180.0050.00814.35
5.5.170.0100.00314.27
5.5.160.0060.00514.18
5.5.150.0080.00214.49
5.5.140.0070.00614.48
5.5.130.0080.00814.48
5.5.120.0080.00614.29
5.5.110.0050.01214.32
5.5.100.0060.00514.44
5.5.90.0050.00814.47
5.5.80.0050.00814.21
5.5.70.0070.00714.15
5.5.60.0050.00814.17
5.5.50.0030.01214.30
5.5.40.0080.00714.32
5.5.30.0030.00914.37
5.5.20.0030.00814.21
5.5.10.0040.00914.45
5.5.00.0020.00914.19
5.4.450.0240.02013.91
5.4.440.0080.02214.09
5.4.430.0090.02014.00
5.4.420.0040.02514.01
5.4.410.0110.02613.85
5.4.400.0080.02613.76
5.4.390.0090.02513.67
5.4.380.0140.02413.77
5.4.370.0060.03213.46
5.4.360.0060.02913.69
5.4.350.0120.02713.57
5.4.340.0110.02413.52
5.4.330.0020.00711.09
5.4.320.0050.02913.76
5.4.310.0070.02213.77
5.4.300.0060.02213.51
5.4.290.0080.01813.66
5.4.280.0080.02313.68
5.4.270.0090.02013.82
5.4.260.0060.02313.64
5.4.250.0060.02213.57
5.4.240.0090.02313.48
5.4.230.0040.02413.50
5.4.220.0060.03213.57
5.4.210.0050.02513.77
5.4.200.0100.02412.92
5.4.190.0080.02513.70
5.4.180.0070.02213.67
5.4.170.0080.02213.69
5.4.160.0050.02213.69
5.4.150.0120.01713.60
5.4.140.0090.02012.89
5.4.130.0100.01812.75
5.4.120.0080.02312.83
5.4.110.0110.02112.88
5.4.100.0070.02012.79
5.4.90.0070.02012.87
5.4.80.0080.01912.79
5.4.70.0040.02312.92
5.4.60.0070.02112.90
5.4.50.0080.02212.86
5.4.40.0040.02412.87
5.4.30.0050.02112.91
5.4.20.0080.02112.85
5.4.10.0060.02112.85
5.4.00.0050.02812.62
5.3.290.0170.05314.71
5.3.280.0000.06314.63
5.3.270.0200.04714.66
5.3.260.0170.07014.82
5.3.250.0200.06314.71
5.3.240.0170.06714.73
5.3.230.0170.05014.59
5.3.220.0170.05314.68
5.3.210.0130.07014.63
5.3.200.0230.05314.70
5.3.190.0100.05314.61
5.3.180.0000.06014.67
5.3.170.0170.04314.70
5.3.160.0200.06314.57
5.3.150.0330.04014.77
5.3.140.0070.06014.59
5.3.130.0130.06014.65
5.3.120.0170.06714.55
5.3.110.0100.05714.72
5.3.100.0200.06314.20
5.3.90.0200.06314.01
5.3.80.0130.06014.05
5.3.70.0200.05714.25
5.3.60.0100.05314.06
5.3.50.0100.05313.93
5.3.40.0070.07013.98
5.3.30.0030.05713.96
5.3.20.0230.03313.75
5.3.10.0030.05713.79
5.3.00.0100.06713.70
5.2.170.0030.04711.37
5.2.160.0100.04011.27
5.2.150.0130.03711.18
5.2.140.0130.05311.15
5.2.130.0070.05311.13
5.2.120.0100.03711.13
5.2.110.0030.04311.14
5.2.100.0130.03311.14
5.2.90.0030.04711.18
5.2.80.0170.04311.21
5.2.70.0070.04311.31
5.2.60.0100.04011.05
5.2.50.0130.03311.09
5.2.40.0100.03711.05
5.2.30.0100.03711.09
5.2.20.0000.04711.01
5.2.10.0100.04010.97
5.2.00.0100.04010.76
5.1.60.0130.04310.03
5.1.50.0070.03710.07
5.1.40.0070.03310.03
5.1.30.0000.04310.46
5.1.20.0070.03710.41
5.1.10.0030.03710.27
5.1.00.0030.04310.12
5.0.50.0070.0378.58
5.0.40.0070.0278.55
5.0.30.0070.0438.25
5.0.20.0100.0278.32
5.0.10.0100.0238.31
5.0.00.0100.0508.28
4.4.90.0100.0176.00
4.4.80.0000.0275.95
4.4.70.0030.0275.92
4.4.60.0030.0305.96
4.4.50.0000.0275.94
4.4.40.0070.0336.04
4.4.30.0070.0205.91
4.4.20.0030.0235.98
4.4.10.0070.0306.11
4.4.00.0000.0406.07
4.3.110.0030.0275.86
4.3.100.0000.0235.82
4.3.90.0070.0205.84
4.3.80.0100.0375.80
4.3.70.0070.0275.82
4.3.60.0100.0235.84
4.3.50.0130.0135.88
4.3.40.0000.0375.77
4.3.30.0070.0234.71
4.3.20.0000.0234.56
4.3.10.0000.0234.60
4.3.00.0070.01715.60

preferences:
53.74 ms | 400 KiB | 5 Q