3v4l.org

run code in 300+ PHP versions simultaneously
<?php // result from query: SELECT * FROM depts $depts = array( array( // row #0 'deptid' => 1, 'dept_code' => '1', 'dept_name' => 'wadir Umum', 'parent_deptid' => 0, ), array( // row #1 'deptid' => 2, 'dept_code' => '101', 'dept_name' => 'bagian umum', 'parent_deptid' => 1, ), array( // row #2 'deptid' => 3, 'dept_code' => '10101', 'dept_name' => 'kepala umum', 'parent_deptid' => 2, ), array( // row #3 'deptid' => 4, 'dept_code' => '102', 'dept_name' => 'bagian privasi', 'parent_deptid' => 1, ), array( // row #4 'deptid' => 5, 'dept_code' => '1010101', 'dept_name' => 'SUb bagian Tu', 'parent_deptid' => 3, ), array( // row #5 'deptid' => 6, 'dept_code' => '1010102', 'dept_name' => 'bagian umum', 'parent_deptid' => 3, ), ); $nodes = array(); $roots = array(); // init nodes foreach ($depts as $dept) { $dept['childs'] = array(); // init childs $nodes[$dept['deptid']] = $dept; } foreach ($depts as $dept) { if ($dept['parent_deptid'] == 0) { $roots[] = $dept['deptid']; // add root } else { $nodes[$dept['parent_deptid']]['childs'][] = $dept['deptid']; // add to parents chlids list } } var_export($roots); echo "\n\n"; var_export($nodes); ?>

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.120.0140.00720.86
8.4.110.0080.00922.23
8.4.100.0030.00617.71
8.4.90.0060.00417.75
8.4.80.0120.00817.99
8.4.70.0140.00917.73
8.4.60.0130.00919.15
8.4.50.0130.00817.89
8.4.40.0130.00719.32
8.4.30.0130.00617.79
8.4.20.0130.00617.55
8.4.10.0060.00317.63
8.3.250.0070.00719.09
8.3.240.0110.00816.57
8.3.230.0140.00616.79
8.3.220.0100.00816.54
8.3.210.0090.00916.52
8.3.200.0020.00716.55
8.3.190.0040.00519.08
8.3.180.0120.00716.51
8.3.170.0050.00518.95
8.3.160.0140.00418.27
8.3.150.0150.00317.23
8.3.140.0040.00416.51
8.3.130.0040.00416.78
8.3.120.0080.00018.91
8.3.110.0130.00620.94
8.3.100.0040.00416.61
8.3.90.0000.00826.77
8.3.80.0030.00719.36
8.3.70.0110.00418.56
8.3.60.0070.00716.38
8.3.50.0140.01022.18
8.3.40.0040.01118.82
8.3.30.0040.01118.84
8.3.20.0040.00419.20
8.3.10.0040.00421.96
8.3.00.0040.00420.94
8.2.290.0030.00522.47
8.2.280.0110.00818.30
8.2.270.0150.00617.57
8.2.260.0040.01119.16
8.2.250.0030.00616.63
8.2.240.0080.00017.13
8.2.230.0040.00722.58
8.2.220.0160.00324.06
8.2.210.0040.00426.77
8.2.200.0090.00018.88
8.2.190.0120.00318.52
8.2.180.0180.00416.63
8.2.170.0070.00722.96
8.2.160.0030.01620.52
8.2.150.0050.00324.18
8.2.140.0030.00624.66
8.2.130.0070.00026.16
8.2.120.0000.00820.01
8.2.110.0050.00521.12
8.2.100.0090.00317.78
8.2.90.0000.00918.03
8.2.80.0060.00318.22
8.2.70.0040.00417.75
8.2.60.0050.00317.63
8.2.50.0080.00018.10
8.2.40.0000.00820.27
8.2.30.0000.00719.23
8.2.20.0040.00417.80
8.2.10.0050.00218.13
8.2.00.0000.00818.11
8.1.330.0130.00616.82
8.1.320.0060.00516.40
8.1.310.0100.00716.62
8.1.300.0070.00317.66
8.1.290.0090.00030.84
8.1.280.0140.00025.92
8.1.270.0080.00023.91
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0060.00320.71
8.1.230.0070.00322.20
8.1.220.0080.00017.74
8.1.210.0030.00618.77
8.1.200.0040.00417.35
8.1.190.0050.00517.35
8.1.180.0040.00418.10
8.1.170.0080.00018.59
8.1.160.0040.00418.96
8.1.150.0000.00718.68
8.1.140.0080.00019.45
8.1.130.0040.00417.77
8.1.120.0040.00417.43
8.1.110.0050.00317.34
8.1.100.0070.00017.50
8.1.90.0050.00217.48
8.1.80.0000.00817.54
8.1.70.0030.00317.37
8.1.60.0040.00417.64
8.1.50.0050.00317.53
8.1.40.0000.00817.43
8.1.30.0030.00517.55
8.1.20.0000.00717.66
8.1.10.0030.00517.63
8.1.00.0000.00817.48
8.0.300.0070.00019.88
8.0.290.0070.00016.63
8.0.280.0040.00418.34
8.0.270.0040.00417.32
8.0.260.0040.00417.25
8.0.250.0030.00317.00
8.0.240.0030.00316.86
8.0.230.0040.00416.92
8.0.220.0050.00316.86
8.0.210.0040.00416.85
8.0.200.0030.00317.00
8.0.190.0040.00416.82
8.0.180.0060.00316.83
8.0.170.0000.00816.82
8.0.160.0030.00316.88
8.0.150.0030.00516.80
8.0.140.0080.00016.86
8.0.130.0050.00013.25
8.0.120.0040.00416.75
8.0.110.0000.00816.95
8.0.100.0050.00216.88
8.0.90.0040.00416.77
8.0.80.0030.01416.95
8.0.70.0070.00016.73
8.0.60.0040.00416.77
8.0.50.0050.00216.99
8.0.30.0110.00717.23
8.0.20.0100.00917.40
8.0.10.0050.00317.04
8.0.00.0120.01216.85
7.4.330.0000.00516.79
7.4.320.0030.00316.50
7.4.300.0040.00416.64
7.4.290.0000.00716.50
7.4.280.0040.00416.61
7.4.270.0000.00716.61
7.4.260.0030.00316.63
7.4.250.0030.00316.40
7.4.240.0040.00416.59
7.4.230.0030.00516.50
7.4.220.0090.00616.60
7.4.210.0100.00616.56
7.4.200.0050.00316.64
7.4.160.0030.01416.57
7.4.150.0120.00817.40
7.4.140.0090.00917.86
7.4.130.0020.01516.67
7.4.120.0100.00716.40
7.4.110.0110.00716.48
7.4.100.0130.00416.34
7.4.90.0060.01116.43
7.4.80.0110.00819.39
7.4.70.0040.01516.70
7.4.60.0040.01316.46
7.4.50.0030.01016.18
7.4.40.0120.00916.54
7.4.30.0130.00716.48
7.4.00.0070.00815.16
7.3.330.0070.00013.07
7.3.320.0000.00513.18
7.3.310.0030.00316.16
7.3.300.0000.00716.26
7.3.290.0000.00616.35
7.3.280.0100.00616.39
7.3.270.0080.00917.40
7.3.260.0130.00716.46
7.3.250.0110.00716.43
7.3.240.0140.00516.36
7.3.230.0090.01216.53
7.3.210.0050.01116.36
7.3.200.0150.00416.64
7.3.190.0130.00316.45
7.3.180.0040.01216.32
7.3.170.0040.01316.23
7.3.160.0030.01316.50
7.3.120.0040.01214.84
7.3.110.0080.00614.68
7.3.100.0100.00614.77
7.3.90.0130.00514.96
7.3.80.0050.01314.79
7.3.70.0080.00814.89
7.3.60.0090.00914.86
7.3.50.0090.00914.84
7.3.40.0070.00714.83
7.3.30.0070.01014.83
7.3.20.0130.00415.59
7.3.10.0110.00615.68
7.3.00.0080.00715.78
7.2.330.0190.00016.73
7.2.320.0070.01316.70
7.2.310.0080.01116.40
7.2.300.0090.00616.46
7.2.290.0140.01016.74
7.2.250.0120.00615.05
7.2.240.0140.00714.80
7.2.230.0030.01515.06
7.2.220.0030.01114.96
7.2.210.0090.00714.99
7.2.200.0070.00815.08
7.2.190.0090.00815.00
7.2.180.0120.00515.02
7.2.170.0070.01015.03
7.2.160.0120.01014.76
7.2.150.0150.00615.00
7.2.140.0140.00715.12
7.2.130.0110.00815.68
7.2.120.0100.01015.66
7.2.110.0100.00815.72
7.2.100.0120.00715.83
7.2.90.0160.00115.86
7.2.80.0100.00915.59
7.2.70.0380.01415.71
7.2.60.0100.00715.99
7.2.50.0080.01215.68
7.2.40.0110.00615.60
7.2.30.0080.00815.80
7.2.20.0110.01215.68
7.2.10.0110.00815.72
7.2.00.0080.00716.68
7.1.330.0040.01115.83
7.1.320.0520.00914.73
7.1.310.0090.00714.55
7.1.300.0080.01014.61
7.1.290.0110.00814.52
7.1.280.0110.00614.64
7.1.270.0120.00614.67
7.1.260.0100.00414.66
7.1.250.0100.00714.61
7.1.240.0150.00914.09
7.1.230.0180.00713.90
7.1.220.0140.00914.05
7.1.210.0100.01114.13
7.1.200.0130.00714.51
7.1.190.1170.01113.95
7.1.180.0100.01313.87
7.1.170.0150.00713.98
7.1.160.0170.00514.00
7.1.150.0120.01113.97
7.1.140.0160.00513.93
7.1.130.0210.00414.03
7.1.120.0090.01014.85
7.1.110.0590.00814.72
7.1.100.0120.00915.74
7.1.90.0210.01214.53
7.1.80.0260.00814.70
7.1.70.0110.00915.13
7.1.60.0350.01220.12
7.1.50.0410.01220.42
7.1.40.0360.01220.13
7.1.30.0270.01220.32
7.1.20.0250.01220.29
7.1.10.0240.01314.20
7.1.00.0220.02416.28
7.0.330.0100.01113.62
7.0.320.0170.00713.43
7.0.310.0140.00713.59
7.0.300.0130.00813.57
7.0.290.0170.00613.63
7.0.280.0180.00213.56
7.0.270.0140.00913.42
7.0.260.0160.00813.54
7.0.250.1250.00414.40
7.0.240.1220.01014.35
7.0.230.0130.00914.19
7.0.220.0210.00814.36
7.0.210.0810.01014.05
7.0.200.0510.00614.10
7.0.190.0090.01214.12
7.0.180.0220.00813.87
7.0.170.0120.01013.94
7.0.160.0200.00813.83
7.0.150.0240.00713.74
7.0.140.0820.01013.79
7.0.130.0250.00813.96
7.0.120.0220.00913.93
7.0.110.0190.01113.93
7.0.100.0230.02015.51
7.0.90.0260.01215.34
7.0.80.0250.01315.44
7.0.70.0160.01615.44
7.0.60.0170.01415.26
7.0.50.0180.01215.49
7.0.40.0150.01515.54
7.0.30.0160.01615.45
7.0.20.0490.01815.43
7.0.10.0160.01715.52
7.0.00.0370.01315.49
5.6.400.0110.01014.69
5.6.390.0160.00614.34
5.6.380.0150.00714.31
5.6.370.0090.01114.32
5.6.360.0140.00814.68
5.6.350.0140.01014.39
5.6.340.0140.00814.19
5.6.330.0120.01014.72
5.6.320.0130.01014.56
5.6.310.0130.01114.38
5.6.300.0200.01916.51
5.6.290.0160.02016.45
5.6.280.0100.04017.73
5.6.270.0120.02716.53
5.6.260.0110.02416.59
5.6.250.0120.02817.56
5.6.240.0120.03217.57
5.6.230.0090.03117.62
5.6.220.0100.03217.57
5.6.210.0120.02817.50
5.6.200.0120.02817.66
5.6.190.0090.03617.68
5.6.180.0110.03117.74
5.6.170.0090.02817.66
5.6.160.0100.02917.65
5.6.150.0130.02717.80
5.6.140.0110.02717.75
5.6.130.0080.03117.63
5.6.120.0120.03417.69
5.6.110.0100.03317.63
5.6.100.0110.02917.71
5.6.90.0130.02817.69
5.6.80.0110.02717.37
5.6.70.0090.02917.34
5.6.60.0100.03017.30
5.6.50.0080.03417.32
5.6.40.0120.02717.32
5.6.30.0110.03317.41
5.6.20.0100.02817.32
5.6.10.0100.03017.24
5.6.00.0130.03417.30
5.5.380.0110.03116.76
5.5.370.0100.02616.73
5.5.360.0140.02416.65
5.5.350.0120.02716.63
5.5.340.0100.03716.85
5.5.330.0120.03616.74
5.5.320.0110.02717.01
5.5.310.0110.03216.91
5.5.300.0110.02616.85
5.5.290.0130.02716.91
5.5.280.0110.03516.90
5.5.270.0100.03516.89
5.5.260.0110.03716.91
5.5.250.0070.03116.69
5.5.240.0120.02616.57
5.5.230.0090.02816.49
5.5.220.0080.02816.54
5.5.210.0110.02816.52
5.5.200.0140.02316.41
5.5.190.0100.02816.50
5.5.180.0120.02416.61
5.5.170.0100.01014.15
5.5.160.0140.03216.43
5.5.150.0110.03516.46
5.5.140.0110.02916.64
5.5.130.0100.03916.62
5.5.120.0150.03716.50
5.5.110.0110.04016.59
5.5.100.0120.03316.56
5.5.90.0100.03016.43
5.5.80.0090.03816.48
5.5.70.0090.03816.44
5.5.60.0110.03316.42
5.5.50.0130.03316.47
5.5.40.0130.03516.38
5.5.30.0090.03616.48
5.5.20.0100.03716.51
5.5.10.0110.03716.37
5.5.00.0070.03616.59

preferences:
32.91 ms | 403 KiB | 5 Q