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' => 1, 'dos' => 2, '3' => 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.0070.00716.46
8.3.50.0100.00922.00
8.3.40.0110.00418.97
8.3.30.0030.01019.26
8.3.20.0050.00320.34
8.3.10.0040.00421.88
8.3.00.0050.00322.43
8.2.180.0170.00018.41
8.2.170.0110.00422.96
8.2.160.0100.00320.35
8.2.150.0050.00324.18
8.2.140.0000.00824.66
8.2.130.0100.01026.16
8.2.120.0000.00722.23
8.2.110.0040.00422.38
8.2.100.0120.00017.84
8.2.90.0060.00319.34
8.2.80.0000.00818.05
8.2.70.0080.00017.63
8.2.60.0050.00318.05
8.2.50.0100.00018.07
8.2.40.0000.00818.28
8.2.30.0030.00618.19
8.2.20.0040.00417.88
8.2.10.0040.00417.89
8.2.00.0080.00017.88
8.1.280.0080.00825.92
8.1.270.0040.00423.97
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0090.00023.85
8.1.230.0000.01119.21
8.1.220.0040.00417.78
8.1.210.0030.00518.77
8.1.200.0050.00717.48
8.1.190.0040.00417.53
8.1.180.0030.00518.10
8.1.170.0040.00418.63
8.1.160.0040.00422.13
8.1.150.0000.00718.73
8.1.140.0050.00317.53
8.1.130.0000.00717.90
8.1.120.0030.00317.43
8.1.110.0040.00417.40
8.1.100.0000.00717.41
8.1.90.0000.00717.54
8.1.80.0070.00017.47
8.1.70.0040.00417.49
8.1.60.0090.00017.70
8.1.50.0030.00517.57
8.1.40.0020.00517.60
8.1.30.0080.00017.67
8.1.20.0000.00817.68
8.1.10.0080.00017.50
8.1.00.0000.00817.49
8.0.300.0060.00318.77
8.0.290.0050.00317.29
8.0.280.0030.00318.43
8.0.270.0040.00417.38
8.0.260.0060.00016.80
8.0.250.0000.00717.00
8.0.240.0000.00817.04
8.0.230.0030.00317.08
8.0.220.0030.00317.04
8.0.210.0000.00716.79
8.0.200.0000.00617.06
8.0.190.0040.00417.07
8.0.180.0020.00516.96
8.0.170.0000.00716.90
8.0.160.0050.00217.02
8.0.150.0060.00316.89
8.0.140.0050.00216.92
8.0.130.0030.00313.27
8.0.120.0040.00416.94
8.0.110.0000.00716.98
8.0.100.0000.00717.09
8.0.90.0040.00417.01
8.0.80.0080.00816.91
8.0.70.0040.00416.87
8.0.60.0070.00016.80
8.0.50.0000.00816.95
8.0.30.0130.01017.05
8.0.20.0060.01217.40
8.0.10.0070.00017.02
8.0.00.0120.00916.79
7.4.330.0020.00315.07
7.4.320.0030.00316.69
7.4.300.0030.00316.68
7.4.290.0030.00316.73
7.4.280.0080.00016.65
7.4.270.0000.00716.51
7.4.260.0000.00716.66
7.4.250.0050.00216.62
7.4.240.0050.00216.54
7.4.230.0000.00716.42
7.4.220.0070.01016.61
7.4.210.0100.00616.73
7.4.200.0040.00416.66
7.4.190.0000.00716.77
7.4.160.0100.00616.45
7.4.150.0080.01117.40
7.4.140.0130.00917.86
7.4.130.0110.00816.62
7.4.120.0110.00816.56
7.4.110.0090.00916.62
7.4.100.0100.01316.51
7.4.90.0120.00616.57
7.4.80.0030.01919.39
7.4.70.0060.01116.64
7.4.60.0110.00716.64
7.4.50.0030.00316.46
7.4.40.0090.00622.77
7.4.30.0050.01116.70
7.4.00.0060.00614.82
7.3.330.0060.00013.31
7.3.320.0020.00213.40
7.3.310.0000.00716.47
7.3.300.0000.00716.32
7.3.290.0030.01016.37
7.3.280.0080.00816.43
7.3.270.0170.00017.40
7.3.260.0000.01816.45
7.3.250.0050.01516.54
7.3.240.0150.00316.46
7.3.230.0110.00616.54
7.3.210.0070.01016.43
7.3.200.0090.01219.39
7.3.190.0160.00716.48
7.3.180.0090.00616.76
7.3.170.0060.00916.36
7.3.160.0080.00816.52
7.3.120.0030.00714.91
7.2.330.0090.01417.00
7.2.320.0160.00716.83
7.2.310.0100.01016.77
7.2.300.0260.03216.69
7.2.290.0030.01416.93
7.2.60.0080.00416.82
7.2.00.0130.01019.48
7.1.200.0090.00615.79
7.1.100.0190.01016.27
7.1.70.0000.00717.18
7.1.60.0210.00019.29
7.1.50.0150.01234.48
7.1.00.0070.07322.40
7.0.200.0000.00816.88
7.0.140.0070.07322.07
7.0.60.0100.07719.82
7.0.50.0070.04017.85
7.0.40.0070.06720.24
7.0.30.0230.07320.10
7.0.20.0230.05020.15
7.0.10.0270.07320.05
7.0.00.0030.07720.25
5.6.280.0070.07021.13
5.6.210.0070.08020.70
5.6.200.0070.05018.29
5.6.190.0100.03720.47
5.6.180.0500.07720.47
5.6.170.0270.07720.47
5.6.160.0070.04320.44
5.6.150.0000.04718.28
5.6.140.0100.03718.29
5.6.130.0030.04718.24
5.6.120.0030.04721.03
5.6.110.0100.07321.10
5.6.100.0130.06320.98
5.6.90.0070.07721.00
5.6.80.0100.08020.41
5.6.70.0200.03320.37
5.5.350.0030.07320.39
5.5.340.0030.04017.96
5.5.330.0100.07720.29
5.5.320.0070.04020.32
5.5.310.0330.07320.37
5.5.300.0100.07717.97
5.5.290.0100.07717.95
5.5.280.0170.07720.89
5.5.270.0070.08020.89
5.5.260.0000.04720.97
5.5.250.0030.05720.63
5.5.240.0170.07320.20
5.4.450.1230.04019.42
5.4.440.0630.06019.63
5.4.430.0570.06019.52
5.4.420.1130.04719.21
5.4.410.0170.06719.36
5.4.400.0800.05018.98
5.4.390.1130.07019.37
5.4.380.0230.04718.75
5.4.370.0200.05018.59
5.4.360.0230.04318.60
5.4.350.0070.06318.72
5.4.340.0230.04718.46
5.4.320.0060.04012.52
5.4.310.0050.04912.51
5.4.300.0050.04012.52
5.4.290.0030.03912.52
5.4.280.0080.03412.41
5.4.270.0070.04112.41
5.4.260.0070.03712.41
5.4.250.0070.04012.41
5.4.240.0030.04712.41
5.4.230.0170.04212.38
5.4.220.0190.04012.38
5.4.210.0230.03612.38
5.4.200.0170.04612.38
5.4.190.0280.06712.38
5.4.180.0170.04212.38
5.4.170.0140.04912.39
5.4.160.0190.04512.38
5.4.150.0260.07212.38
5.4.140.0150.05612.06
5.4.130.0140.05212.05
5.4.120.0210.04712.01
5.4.110.0240.06512.01
5.4.100.0200.04312.00
5.4.90.0120.04712.01
5.4.80.0180.04112.00
5.4.70.0180.04712.00
5.4.60.0170.05312.00
5.4.50.0210.04112.00
5.4.40.0170.04411.98
5.4.30.0250.06711.98
5.4.20.0150.05111.98
5.4.10.0220.03811.98
5.4.00.0110.04711.47
5.3.290.0060.04012.80
5.3.280.0150.05012.70
5.3.270.0230.03912.72
5.3.260.0160.04912.72
5.3.250.0340.09112.72
5.3.240.0150.04912.72
5.3.230.0170.04812.71
5.3.220.0200.04712.68
5.3.210.0250.04012.68
5.3.200.0230.04512.68
5.3.190.0330.09712.68
5.3.180.0190.04912.67
5.3.170.0240.04612.67
5.3.160.0280.06312.67
5.3.150.0200.04512.67
5.3.140.0210.04112.66
5.3.130.0170.04512.66
5.3.120.0430.08412.66
5.3.110.0180.04712.66
5.3.100.0180.04412.12
5.3.90.0220.04312.09
5.3.80.0180.04712.07
5.3.70.0160.05112.07
5.3.60.0200.04612.06
5.3.50.0150.04812.00
5.3.40.0160.04412.00
5.3.30.0150.04311.97
5.3.20.0160.04411.74
5.3.10.0140.04711.71
5.3.00.0180.04211.70
5.2.170.0170.0329.20
5.2.160.0130.0359.20
5.2.150.0120.0359.20
5.2.140.0240.0899.19
5.2.130.0100.0449.15
5.2.120.0120.0429.16
5.2.110.0100.0409.16
5.2.100.0170.0329.17
5.2.90.0160.0429.16
5.2.80.0130.0349.15
5.2.70.0150.0389.15
5.2.60.0100.0369.11
5.2.50.0200.0409.08
5.2.40.0170.0389.05
5.2.30.0190.0639.03
5.2.20.0160.0339.03
5.2.10.0150.0398.94
5.2.00.0100.0468.79
5.1.60.0120.0318.08
5.1.50.0310.0728.07
5.1.40.0100.0438.07
5.1.30.0130.0338.41
5.1.20.0120.0318.44
5.1.10.0150.0318.16
5.1.00.0110.0308.15
5.0.50.0090.0256.64
5.0.40.0100.0256.50
5.0.30.0110.0346.31
5.0.20.0110.0216.27
5.0.10.0110.0216.25
5.0.00.0150.0636.25
4.4.90.0070.0194.78
4.4.80.0100.0174.76
4.4.70.0060.0224.76
4.4.60.0050.0204.75
4.4.50.0070.0204.77
4.4.40.0070.0314.71
4.4.30.0080.0194.76
4.4.20.0090.0184.84
4.4.10.0090.0184.85
4.4.00.0100.0274.76
4.3.110.0110.0244.67
4.3.100.0120.0154.66
4.3.90.0080.0184.63
4.3.80.0080.0314.58
4.3.70.0100.0164.63
4.3.60.0050.0214.63
4.3.50.0090.0164.63
4.3.40.0070.0284.54
4.3.30.0070.0173.32
4.3.20.0050.0193.30
4.3.10.0070.0183.27
4.3.00.0070.01713.14

preferences:
42.34 ms | 400 KiB | 5 Q