Copy Code code as follows:
function Getcloud ($data = Array (), $minFontSize = $maxFontSize = 30)
{
$minimumCount = Min (array_values ($data));
$maximumCount = Max (Array_values ($data));
$spread = $maximumCount-$minimumCount;
$cloudHTML = ';
$cloudTags = Array ();
$spread = = 0 && $spread = 1;
foreach ($data as $tag => $count)
{
$size = $minFontSize + ($count-$minimumCount)
* ($maxFontSize-$minFontSize)/$spread;
$cloudTags [] = ' <a style= ' font-size: '. Floor ($size). ' PX '
. "Href=" # "title=". $tag.
' \ returned a count of '. $count. ' > '
. Htmlspecialchars (Stripslashes ($tag)). ' </a> ';
}
return join ("\ n", $cloudTags). "\ n";
}
/**************************
Sample usage ***/
$arr = Array (' Actionscript ' =>, ' Adobe ' =>, ' Array ' =>, ' Background ' => 43,
' Blur ' =>, ' Canvas ' =>, ' Class ' =>, ' Color Palette ' =>, ' crop ' => 42,
' Delimiter ' =>, ' Depth ' =>, ' design ' => 8, ' Encode ' =>, ' encryption ' => 30,
' Extract ' =>, ' Filters ' => 42);
Echo Getcloud ($arr, 12, 36);
This is an article from the cloud-dwelling community that was published before. More tips can be used for reference.
21 Handy PHP function codes collected