3v4l.org

run code in 300+ PHP versions simultaneously
<?php function word_cloud($words, $div_size = 400) { $tags = 0; $cloud = "<div style=\"width: {$div_size}px\">"; /* This word cloud generation algorithm was taken from the Wikipedia page on "word cloud" with some minor modifications to the implementation */ /* Initialize some variables */ $fmax = 96; /* Maximum font size */ $fmin = 8; /* Minimum font size */ $tmin = min($words); /* Frequency lower-bound */ $tmax = max($words); /* Frequency upper-bound */ foreach ($words as $word => $frequency) { if ($frequency > $tmin) { $font_size = floor( ( $fmax * ($frequency - $tmin) ) / ( $tmax - $tmin ) ); /* Define a color index based on the frequency of the word */ $r = $g = 0; $b = floor( 255 * ($frequency / $tmax) ); $color = '#' . sprintf('%02s', dechex($r)) . sprintf('%02s', dechex($g)) . sprintf('%02s', dechex($b)); } else { $font_size = 0; } if ($font_size >= $fmin) { $cloud .= "<span style=\"font-size: {$font_size}px; color: $color;\">$word</span> "; $tags++; } } $cloud .= "</div>"; return array($cloud, $tags); } $words = ['una' => 2, 'dos' => 2, 'qweqwe' => 3]; var_dump(word_cloud($words));

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.0040.01118.43
8.3.50.0090.00616.36
8.3.40.0150.00018.76
8.3.30.0110.00420.39
8.3.20.0050.00320.18
8.3.10.0040.00421.95
8.3.00.0050.00322.51
8.2.180.0070.00716.63
8.2.170.0040.01122.96
8.2.160.0030.01022.12
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0040.00420.70
8.2.110.0030.00622.16
8.2.100.0080.00817.91
8.2.90.0060.00319.31
8.2.80.0080.00019.15
8.2.70.0060.00317.63
8.2.60.0000.00818.16
8.2.50.0040.00418.07
8.2.40.0050.00318.15
8.2.30.0000.00819.51
8.2.20.0040.00417.79
8.2.10.0030.00617.68
8.2.00.0050.00217.68
8.1.270.0070.00023.99
8.1.260.0040.00426.35
8.1.250.0050.00228.09
8.1.240.0070.00323.65
8.1.230.0070.00417.77
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0000.00917.35
8.1.190.0030.00617.53
8.1.180.0030.00618.10
8.1.170.0040.00418.47
8.1.160.0000.00818.95
8.1.150.0040.00418.59
8.1.140.0000.00717.51
8.1.130.0000.00717.84
8.1.120.0040.00417.44
8.1.110.0040.00417.42
8.1.100.0040.00417.33
8.1.90.0030.00617.45
8.1.80.0000.00717.46
8.1.70.0040.00417.48
8.1.60.0060.00317.48
8.1.50.0040.00417.51
8.1.40.0040.00417.43
8.1.30.0050.00317.60
8.1.20.0000.00817.55
8.1.10.0040.00417.57
8.1.00.0050.00517.47
8.0.300.0000.00818.77
8.0.290.0000.00717.18
8.0.280.0030.00318.57
8.0.270.0000.00717.27
8.0.260.0000.00616.89
8.0.250.0030.00316.91
8.0.240.0000.00816.99
8.0.230.0050.00517.03
8.0.220.0000.00716.79
8.0.210.0000.00716.89
8.0.200.0000.00616.83
8.0.190.0040.00416.96
8.0.180.0030.00316.95
8.0.170.0040.00416.95
8.0.160.0080.00016.79
8.0.150.0040.00416.90
8.0.140.0050.00316.89
8.0.130.0060.00013.35
8.0.120.0030.00516.80
8.0.110.0000.00716.74
8.0.100.0040.00416.93
8.0.90.0040.00416.95
8.0.80.0060.01616.84
8.0.70.0080.00016.97
8.0.60.0040.00416.73
8.0.50.0000.00716.77
8.0.30.0110.01317.27
8.0.20.0080.01217.40
8.0.10.0040.00416.87
8.0.00.0080.01116.64
7.4.330.0000.00414.93
7.4.320.0060.00016.53
7.4.300.0060.00016.62
7.4.290.0030.00316.54
7.4.280.0050.00216.62
7.4.270.0030.00316.52
7.4.260.0050.00313.38
7.4.250.0040.00416.58
7.4.240.0070.00216.54
7.4.230.0040.00416.66
7.4.220.0100.01716.54
7.4.210.0060.00816.66
7.4.200.0000.00716.51
7.4.190.0040.00416.48
7.4.160.0070.01016.35
7.4.150.0090.00917.40
7.4.140.0070.01017.86
7.4.130.0060.01016.43
7.4.120.0100.01116.46
7.4.110.0090.01516.48
7.4.100.0030.01316.57
7.4.90.0110.00616.45
7.4.80.0070.01119.39
7.4.70.0120.00416.50
7.4.60.0070.01016.50
7.4.50.0040.00416.58
7.4.40.0120.00322.77
7.4.30.0030.01216.64
7.4.00.0110.00415.15
7.3.330.0000.00513.36
7.3.320.0020.00213.25
7.3.310.0000.00716.49
7.3.300.0040.00416.43
7.3.290.0070.00716.32
7.3.280.0070.01416.40
7.3.270.0160.00317.40
7.3.260.0080.01216.71
7.3.250.0070.01116.42
7.3.240.0100.01316.51
7.3.230.0090.00816.64
7.3.210.0120.00416.30
7.3.200.0130.00919.39
7.3.190.0140.00316.47
7.3.180.0030.01316.56
7.3.170.0150.00016.59
7.3.160.0130.01016.49
7.3.120.0090.00314.50
7.2.330.0150.00316.73
7.2.320.0100.01416.83
7.2.310.0160.00616.67
7.2.300.0130.00316.67
7.2.290.0090.01216.79
7.2.00.0120.00319.55
7.1.100.0070.01018.06
7.1.70.0040.00417.23
7.1.60.0070.01519.20
7.1.50.0250.00934.97
7.1.00.0030.03322.57
7.0.200.0040.00814.66
7.0.140.0000.07722.07
7.0.100.0100.04319.98
7.0.90.0170.06719.92
7.0.80.0100.05719.91
7.0.70.0130.07319.95
7.0.60.0270.06319.99
7.0.50.0100.08320.34
7.0.40.0030.07720.03
7.0.30.0030.08720.07
7.0.20.0030.08320.13
7.0.10.0070.04720.10
7.0.00.0200.07020.04
5.6.280.0030.07320.90
5.6.250.0100.04320.61
5.6.240.0070.08320.73
5.6.230.0100.04720.64
5.6.220.0170.04320.63
5.6.210.0170.03720.58
5.6.200.0100.08721.06
5.6.190.0130.07721.13
5.6.180.0070.08321.11
5.6.170.0030.05321.09
5.6.160.0100.04720.96
5.6.150.0030.04720.97
5.6.140.0070.08321.17
5.6.130.0030.06020.97
5.6.120.0100.08320.94
5.6.110.0130.08321.18
5.6.100.0070.05320.95
5.6.90.0170.08021.07
5.6.80.0070.04720.45
5.6.70.0030.06320.50
5.6.60.0070.04720.48
5.6.50.0100.07020.44
5.6.40.0130.05020.40
5.6.30.0030.06020.45
5.6.20.0030.04320.40
5.6.10.0070.04020.49
5.6.00.0100.07720.35
5.5.380.0100.03720.47
5.5.370.0130.04020.37
5.5.360.0100.08020.51
5.5.350.0130.07720.43
5.5.340.0000.08320.81
5.5.330.0070.08020.80
5.5.320.0070.08020.88
5.5.310.0130.07720.92
5.5.300.0100.07720.85
5.5.290.0070.05320.65
5.5.280.0170.07720.92
5.5.270.0000.07720.78
5.5.260.0070.05020.90
5.5.250.0130.07720.75
5.5.240.0070.08720.17
5.5.230.0070.08320.22
5.5.220.0170.07020.16
5.5.210.0030.08020.28
5.5.200.0100.06020.14
5.5.190.0170.07020.23
5.5.180.0030.08020.24
5.5.160.0070.07720.28
5.5.150.0070.07720.00
5.5.140.0200.07020.09
5.5.130.0170.03720.13
5.5.120.0000.08720.23
5.5.110.0070.07720.00
5.5.100.0030.08020.19
5.5.90.0030.07020.05
5.5.80.0130.07020.14
5.5.70.0130.07020.16
5.5.60.0100.07320.13
5.5.50.0030.04720.17
5.5.40.0070.04320.16
5.5.30.0100.07720.04
5.5.20.0070.08019.94
5.5.10.0070.07320.01
5.5.00.0100.05020.11
5.4.450.0070.04719.49
5.4.440.0070.07719.54
5.4.430.0170.06719.41
5.4.420.0070.03719.32
5.4.410.0070.04719.33
5.4.400.0070.07719.13
5.4.390.0130.06318.90
5.4.380.0070.08018.88
5.4.370.0130.07018.91
5.4.360.0070.04719.12
5.4.350.0070.07319.16
5.4.340.0100.07319.03
5.4.320.0170.06319.09
5.4.310.0030.08018.91
5.4.300.0130.07319.12
5.4.290.0130.04019.12
5.4.280.0100.05318.88
5.4.270.0070.07318.87
5.4.260.0100.06019.17
5.4.250.0100.07319.04
5.4.240.0000.06319.18
5.4.230.0070.06719.17
5.4.220.0070.08018.84
5.4.210.0130.04718.84
5.4.200.0130.06718.89
5.4.190.0130.04019.02
5.4.180.0100.05019.08
5.4.170.0100.07019.08
5.4.160.0170.03319.01
5.4.150.0100.07019.02
5.4.140.0130.07016.41
5.4.130.0000.06016.44
5.4.120.0000.06316.45
5.4.110.0030.07716.28
5.4.100.0030.06316.36
5.4.90.0070.07716.43
5.4.80.0030.06016.43
5.4.70.0070.07316.34
5.4.60.0030.07016.45
5.4.50.0170.06716.45
5.4.40.0100.03716.51
5.4.30.0170.06716.45
5.4.20.0070.05316.48
5.4.10.0070.07016.36
5.4.00.0000.03715.90
5.3.290.0070.07314.65
5.3.280.0000.04314.57
5.3.270.0130.07314.68
5.3.260.0170.07014.68
5.3.250.0170.06714.73
5.3.240.0100.07714.75
5.3.230.0100.07314.66
5.3.220.0130.07314.64
5.3.210.0200.06714.56
5.3.200.0000.08014.68
5.3.190.0070.07714.58
5.3.180.0130.06314.70
5.3.170.0070.04314.55
5.3.160.0100.06714.64
5.3.150.0130.03714.56
5.3.140.0000.08314.63
5.3.130.0100.04014.52
5.3.120.0070.07314.65
5.3.110.0000.04014.61
5.3.100.0070.06314.17
5.3.90.0030.03714.05
5.3.80.0070.07313.95
5.3.70.0100.07314.04
5.3.60.0130.06014.12
5.3.50.0070.07313.94
5.3.40.0030.06713.89
5.3.30.0000.07713.85
5.3.20.0030.03713.68
5.3.10.0030.04013.80
5.3.00.0070.06713.68
5.2.170.0000.07013.68
5.2.160.0030.05313.68
5.2.150.0030.06013.68
5.2.140.0070.05713.68
5.2.130.0000.04713.68
5.2.120.0000.05313.68
5.2.110.0130.02713.68
5.2.100.0000.06713.68
5.2.90.0030.05313.68
5.2.80.0000.06313.68
5.2.70.0030.03713.68
5.2.60.0030.05013.68
5.2.50.0030.06313.68
5.2.40.0130.05013.68
5.2.30.0170.03313.68
5.2.20.0070.05313.68
5.2.10.0070.05713.68
5.2.00.0030.06313.68
5.1.60.0000.04713.68
5.1.50.0070.04713.68
5.1.40.0130.04313.68
5.1.30.0070.05313.68
5.1.20.0070.04713.68
5.1.10.0030.05713.68
5.1.00.0070.05313.68
5.0.50.0000.03313.68
5.0.40.0070.04013.68
5.0.30.0100.05713.68
5.0.20.0000.04013.68
5.0.10.0000.04713.68
5.0.00.0030.03313.68
4.4.90.0000.04013.68
4.4.80.0030.03313.68
4.4.70.0030.03013.68
4.4.60.0000.02013.68
4.4.50.0000.02013.68
4.4.40.0100.03313.68
4.4.30.0030.03313.68
4.4.20.0030.02313.68
4.4.10.0070.03013.68
4.4.00.0030.05713.68
4.3.110.0030.03313.68
4.3.100.0030.03313.68
4.3.90.0100.02713.68
4.3.80.0000.04713.68
4.3.70.0000.02013.68
4.3.60.0070.01313.68
4.3.50.0030.02713.68
4.3.40.0000.05313.68
4.3.30.0000.02013.68
4.3.20.0000.02713.68
4.3.10.0030.03713.68
4.3.00.0030.02313.68

preferences:
44.26 ms | 400 KiB | 5 Q