3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* function balancedTagCloud(array $values, array $priorities): array { $low = min($priorities) - 1; $high = max($priorities) - $low; return array_map( fn($v, $p) => sprintf( '<h%1$d>%2$s</h%1$d>', ceil(($p - $low) / $high * 6), $v ), $values, $priorities ); } */ $artist = ["the roots", "michael jackson", "billy idol", "more", "and more", "and_YET_MORE"]; /*$counts = [ 'original' => [5, 3, 9, 1, 1, 3], 'no_ones' => [5, 3, 9, 7, 7, 3], 'skewed' => [5, 3, 9, 7, 111, 3], 'all_same' => [5, 5, 5, 5, 5, 5], 'only_two' => [9, 20, 9, 20, 9, 20], ]; foreach ($counts as $count) { echo implode("\n", balancedTagCloud($artist, $count)); echo "\n---\n"; }*/ $count = [5, 3, 9, 1, 1, 3]; $steps = 6; $tags = []; $min = 1e9; $max = -1e9; foreach ($artist as $i => $name) { $c = log($count[$i]); $min = min($min, $c); $max = max($max, $c); $tags[] = (object) ['weight' => $count[$i], 'name' => $name, 'count' => $c]; } $range = max(.01, $max - $min) * 1.0001; foreach ($tags as $obj) { $obj->weight = 1 + floor($steps * ($obj->count - $min) / $range); } foreach ($tags as $tag) { echo "<h$tag->weight>$tag->name</h$tag->weight>\n"; }

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.10.0170.00618.57
8.5.00.0150.00620.18
8.4.160.0120.00924.06
8.4.150.0030.00014.05
8.4.140.0100.01217.76
8.4.130.0150.00617.79
8.4.120.0130.00720.67
8.4.110.0120.00719.04
8.4.100.0140.00718.75
8.4.90.0140.00519.10
8.4.80.0130.00720.62
8.4.70.0080.00919.00
8.4.60.0100.01019.00
8.4.50.0120.00818.70
8.4.40.0070.01417.63
8.4.30.0070.01319.09
8.4.20.0140.00719.68
8.4.10.0110.00719.58
8.3.280.0120.01118.68
8.3.270.0110.00916.67
8.3.260.0110.00916.82
8.3.250.0150.00419.05
8.3.240.0140.00616.90
8.3.230.0080.00117.00
8.3.220.0050.00319.12
8.3.210.0120.00816.79
8.3.200.0070.00216.63
8.3.190.0040.00519.25
8.3.180.0140.00718.94
8.3.170.0040.01116.68
8.3.160.0060.01217.30
8.3.150.0140.00417.37
8.3.140.0110.00720.89
8.3.130.0080.00018.48
8.3.120.0070.00319.25
8.3.110.0090.00020.94
8.3.100.0060.00324.06
8.3.90.0080.00026.77
8.3.80.0080.00418.52
8.3.70.0070.00716.60
8.3.60.0190.00316.75
8.3.50.0070.01118.70
8.3.40.0090.00620.12
8.3.30.0070.01121.98
8.3.20.0040.00424.18
8.3.10.0080.00024.66
8.3.00.0080.00026.16
8.2.290.0110.00820.67
8.2.280.0080.00718.72
8.2.270.0110.00417.38
8.2.260.0120.00316.79
8.2.250.0000.00816.88
8.2.240.0150.00017.52
8.2.230.0040.00422.58
8.2.220.0090.00037.54
8.2.210.0080.00026.77
8.2.200.0030.00618.69
8.2.190.0120.00316.88
8.2.180.0100.00718.67
8.2.170.0150.00419.06
8.2.160.0100.00322.96
8.2.150.0040.00425.66
8.2.140.0080.00024.66
8.2.130.0070.00026.16
8.2.120.0100.01021.07
8.2.110.0420.00317.88
8.2.100.0250.01117.50
8.2.90.0090.01817.63
8.2.80.0300.00317.86
8.2.70.0200.00717.63
8.2.60.0130.00717.38
8.2.50.0110.00819.27
8.2.40.0160.00019.30
8.2.30.0170.00019.26
8.2.20.0170.00019.25
8.2.10.0130.00419.52
8.2.00.0130.00419.25
8.1.330.0130.00716.23
8.1.320.0110.00816.33
8.1.310.0090.00616.32
8.1.300.0030.00618.60
8.1.290.0000.01030.84
8.1.280.0090.00925.92
8.1.270.0030.00624.09
8.1.260.0050.00326.35
8.1.250.0110.00817.61
8.1.240.0070.01017.48
8.1.230.0140.00317.48
8.1.220.0140.00317.63
8.1.210.0130.01017.48
8.1.200.0320.00617.47
8.1.190.0130.01817.38
8.1.180.0270.00317.13
8.1.170.0160.00617.47
8.1.160.0170.00217.49
8.1.150.0190.00017.36
8.1.140.0150.00617.35
8.1.130.0240.01417.11
8.1.120.0300.00917.25
8.1.110.0200.00317.25
8.1.100.0160.00417.47
8.1.90.0160.00317.25
8.1.80.0170.00217.50
8.1.70.0340.00417.35
8.1.60.0260.01117.37
8.1.50.0160.00317.50
8.1.40.0110.00717.72
8.1.30.0230.00817.61
8.1.20.0360.00617.50
8.1.10.0310.01017.63
8.1.00.0270.01517.60
8.0.300.0190.01516.75
8.0.290.0280.01316.88
8.0.280.0340.00316.75
8.0.270.0310.00416.74
8.0.260.0240.00616.75
8.0.250.0380.00416.88
8.0.240.0300.01116.84
8.0.230.0320.00016.88
8.0.220.0380.00316.75
8.0.210.0220.00916.88
8.0.200.0250.00616.88
8.0.190.0240.00816.88
8.0.180.0350.00716.59
8.0.170.0400.00316.88
8.0.160.0350.00416.75
8.0.150.0330.01216.63
8.0.140.0410.00016.50
8.0.130.0250.00916.63
8.0.120.0180.01216.75
8.0.110.0280.01116.75
8.0.100.0390.00316.75
8.0.90.0170.00816.63
8.0.80.0130.00716.75
8.0.70.0120.00616.75
8.0.60.0260.00316.63
8.0.50.0280.00916.63
8.0.30.0230.00016.50
8.0.20.0110.00616.63
8.0.10.0090.00918.24

preferences:
99.57 ms | 403 KiB | 5 Q