3v4l.org

run code in 300+ PHP versions simultaneously
<?php function setTier(array $nodes, $tier = 1) { return array_map(function ($node) use ($tier) { $node->tier = $tier; $node->children = setTier($node->children, $tier + 1); return $node; }, $nodes); } $structure = json_decode(' [{ "name": "a", "children": [{ "name": "c", "children": [{ "name": "e", "children": [{ "name": "g", "children": [] }] }, { "name": "f", "children": [] }] }, { "name": "d", "children": [{ "name": "h", "children": [] }] }] }, { "name": "b", "children": [] }] '); $structure = setTier($structure); print_r($structure); die;

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.130.0040.00416.57
8.3.120.0060.00918.75
8.3.110.0050.00516.65
8.3.100.0000.00816.54
8.3.90.0030.00618.54
8.3.80.0100.00018.43
8.3.70.0110.00416.50
8.3.60.0120.00416.63
8.3.50.0030.01016.51
8.3.40.0080.00618.74
8.3.30.0040.01118.77
8.3.20.0080.00021.95
8.3.10.0040.00421.89
8.3.00.0020.00521.89
8.2.250.0180.00316.56
8.2.240.0050.00318.94
8.2.230.0030.00520.94
8.2.220.0080.00024.06
8.2.210.0000.01426.77
8.2.200.0090.00016.50
8.2.190.0120.00316.63
8.2.180.0130.01016.38
8.2.170.0080.00822.96
8.2.160.0150.00022.00
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0060.00321.00
8.2.120.0050.00326.35
8.2.110.0030.00722.11
8.2.100.0040.00817.91
8.2.90.0040.00419.20
8.2.80.0040.00417.97
8.2.70.0000.00817.75
8.2.60.0040.00417.80
8.2.50.0070.00318.07
8.2.40.0040.00418.34
8.2.30.0040.00418.08
8.2.20.0000.00718.03
8.2.10.0000.00718.07
8.2.00.0050.00318.12
8.1.300.0030.01719.51
8.1.290.0040.00418.88
8.1.280.0100.00625.92
8.1.270.0070.00022.16
8.1.260.0030.00626.35
8.1.250.0050.00328.09
8.1.240.0060.00320.82
8.1.230.0070.00417.70
8.1.220.0050.00317.74
8.1.210.0060.00318.77
8.1.200.0000.01017.35
8.1.190.0000.00917.35
8.1.180.0060.00318.10
8.1.170.0000.00820.42
8.1.160.0000.00818.89
8.1.150.0000.00719.08
8.1.140.0040.00417.63
8.1.130.0050.00518.96
8.1.120.0080.00017.48
8.1.110.0050.00317.48
8.1.100.0040.00417.45
8.1.90.0040.00417.50
8.1.80.0060.00317.50
8.1.70.0000.00817.48
8.1.60.0060.00317.66
8.1.50.0040.00417.57
8.1.40.0080.00017.52
8.1.30.0060.00317.65
8.1.20.0040.00417.55
8.1.10.0000.01117.52
8.1.00.0030.00617.42
8.0.300.0040.00418.77
8.0.290.0070.00416.88
8.0.280.0070.00018.37
8.0.270.0000.00717.18
8.0.260.0000.00718.97
8.0.250.0000.00717.02
8.0.240.0040.00417.03
8.0.230.0030.00617.05
8.0.220.0060.00316.84
8.0.210.0030.00316.94
8.0.200.0040.00417.03
8.0.190.0000.00716.99
8.0.180.0050.00317.00
8.0.170.0060.00316.87
8.0.160.0040.00416.95
8.0.150.0040.00416.85
8.0.140.0000.00716.86
8.0.130.0030.00313.37
8.0.120.0000.00716.90
8.0.110.0080.00016.98
8.0.100.0020.00516.85
8.0.90.0040.00417.00
8.0.80.0120.00616.98
8.0.70.0000.00716.89
8.0.60.0070.00016.76
8.0.50.0000.00716.88
8.0.30.0090.00817.13
8.0.20.0150.00817.40
8.0.10.0040.00416.91
8.0.00.0060.01116.75
7.4.330.0060.00015.55
7.4.320.0040.00416.61
7.4.300.0000.00616.65
7.4.290.0000.00716.61
7.4.280.0050.00316.50
7.4.270.0070.00016.50
7.4.260.0040.00416.46
7.4.250.0000.00816.49
7.4.240.0040.00416.68
7.4.230.0070.00016.38
7.4.220.0040.00416.42
7.4.210.0080.00816.49
7.4.200.0000.00716.63
7.4.160.0100.01016.57
7.4.140.0070.01117.86
7.4.130.0110.00716.47
7.4.120.0040.01416.57
7.4.110.0140.00316.63
7.4.100.0130.00316.54
7.4.90.0070.01116.59
7.4.80.0100.01319.39
7.4.70.0100.00716.63
7.4.60.0130.00316.58
7.4.50.0100.00716.65
7.4.40.0120.00616.53
7.4.10.0030.01414.98
7.4.00.0080.01014.96
7.3.330.0000.00513.29
7.3.320.0060.00013.43
7.3.310.0030.00316.44
7.3.300.0070.00016.48
7.3.290.0030.00316.30
7.3.280.0090.01116.46
7.3.260.0140.01216.45
7.3.240.0090.00916.48
7.3.230.0030.01616.42
7.3.210.0130.00316.39
7.3.200.0160.00016.59
7.3.190.0000.01616.43
7.3.180.0030.01316.41
7.3.170.0150.00316.45
7.3.160.0140.00716.42
7.3.130.0130.00714.88
7.3.120.0070.01014.94
7.3.110.0090.00914.86
7.3.100.0110.00114.83
7.3.90.0030.00914.80
7.3.80.0090.00914.92
7.3.70.0030.00814.61
7.3.60.0060.00514.88
7.3.50.0090.00614.72
7.3.40.0030.00914.84
7.3.30.0040.00914.82
7.3.20.0070.00516.52
7.3.10.0070.00316.63
7.3.00.0030.00816.68
7.2.330.0060.01116.88
7.2.320.0100.00816.86
7.2.310.0030.01316.64
7.2.300.0090.00616.71
7.2.290.0060.01216.68
7.2.260.0070.01014.84
7.2.250.0070.01115.06
7.2.240.0080.01015.17
7.2.230.0030.01215.16
7.2.220.0040.00915.04
7.2.210.0070.00715.14
7.2.200.0030.01015.12
7.2.190.0060.00415.10
7.2.180.0040.01115.01
7.2.170.0040.00914.91
7.2.160.0030.01314.96
7.2.150.0090.00617.10
7.2.140.0060.01017.15
7.2.130.0070.01316.68
7.2.120.0040.01116.90
7.2.110.0030.00716.71
7.2.100.0030.01417.00
7.2.90.0030.00717.00
7.2.80.0060.00317.06
7.2.70.0060.00916.89
7.2.60.0100.00416.98
7.2.50.0060.00716.88
7.2.40.0790.01017.54
7.2.30.0770.00817.24
7.2.20.0440.00517.38
7.2.10.0440.01117.36
7.2.00.0770.01017.34
7.1.330.0090.00515.66
7.1.320.0040.00815.82
7.1.310.0050.00715.66
7.1.300.0040.00715.75
7.1.290.0050.01015.89
7.1.280.0100.00415.60
7.1.270.0030.01015.81
7.1.260.0060.00915.77
7.1.250.0070.00715.65
7.1.240.0060.00615.75
7.1.230.0100.00315.90
7.1.220.0100.00615.84
7.1.210.0040.00415.75
7.1.200.0040.00815.85
7.1.190.0060.00915.57
7.1.180.0040.00915.93
7.1.170.0040.01115.91
7.1.160.0700.00916.20
7.1.150.0820.00816.26
7.1.140.0540.01016.39
7.1.130.0590.00816.04
7.1.120.0830.01316.23
7.1.110.0540.01016.06
7.1.100.0650.00615.92
7.1.90.0730.01116.00
7.1.80.0610.00716.19
7.1.70.0720.01115.52
7.1.60.0630.01024.55
7.1.50.0860.00624.44
7.1.40.0840.01124.22
7.1.30.0760.01224.32
7.1.20.0890.01024.28
7.1.10.0760.00915.34
7.1.00.0860.01015.37
7.0.330.0070.01115.40
7.0.320.0040.01415.37
7.0.310.0040.01515.19
7.0.300.0150.00315.23
7.0.290.0070.00715.61
7.0.280.0100.00715.28
7.0.270.0060.01315.47
7.0.260.0100.00315.14
7.0.250.0120.00315.61
7.0.240.0090.01015.55
7.0.230.0100.00615.50
7.0.220.0030.01015.39
7.0.210.0100.01015.29
7.0.200.0100.00615.48
7.0.190.0140.00315.55
7.0.180.0060.01015.21
7.0.170.0090.00915.30
7.0.160.0110.00315.37
7.0.150.0060.00315.19
7.0.140.0060.00615.59
7.0.130.0120.00415.53
7.0.120.0090.01215.31
7.0.110.0110.00615.09
7.0.100.0070.01015.57
7.0.90.0030.01415.59
7.0.80.0070.01015.16
7.0.70.0070.00415.41
7.0.60.0130.00315.40
7.0.50.0120.00015.39
7.0.40.0070.00713.36
7.0.30.0090.00613.62
7.0.20.0160.00013.36
7.0.10.0090.00313.35
7.0.00.0050.00513.37
5.6.400.0110.00614.48
5.6.390.0030.01013.97
5.6.380.0060.01014.24
5.6.370.0060.01014.39
5.6.360.0140.00014.31
5.6.350.0100.00714.54
5.6.340.0070.01114.68
5.6.330.0090.00614.54
5.6.320.0070.01014.64
5.6.310.0060.00914.14
5.6.300.0030.00714.09
5.6.290.0060.00914.19
5.6.280.0090.00914.37
5.6.270.0140.00714.61
5.6.260.0060.00614.52
5.6.250.0110.00414.38
5.6.240.0070.01314.30
5.6.230.0080.00814.33
5.6.220.0070.00314.49
5.6.210.0120.00314.58
5.6.200.0000.01614.31
5.6.190.0030.01614.34
5.6.180.0070.00414.66
5.6.170.0080.00414.18
5.6.160.0100.00714.52
5.6.150.0070.01414.63
5.6.140.0040.01514.53
5.6.130.0100.01014.33
5.6.120.0040.01414.14
5.6.110.0150.00314.43
5.6.100.0060.00914.37
5.6.90.0080.00414.53
5.6.80.0100.00714.41
5.6.70.0120.00414.42
5.6.60.0080.00514.39
5.6.50.0060.01314.20
5.6.40.0140.00314.39
5.6.30.0110.01114.23
5.6.20.0070.01514.41
5.6.10.0030.01414.56
5.6.00.0030.01214.32

preferences:
15.82 ms | 403 KiB | 5 Q