Copy CodeThe code is as follows:
function Getcloud ($data = Array (), $minFontSize = A, $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 [] = ' \ ' returned a count of '. $count. ' > '
. Htmlspecialchars (Stripslashes ($tag)). '';
}
return join ("\ n", $cloudTags). "\ n";
}
/**************************
Sample usage ***/
$arr = Array (' Actionscript ' = +, ' Adobe ' = ' + ', ' array ' = +, ' Background ' = 43,
' Blur ' +, ' Canvas ' = +, ' Class ' = ', ' Color Palette ' and ' 42 ', ' Crop ',
' Delimiter ' and ' Depth ', ' Design ' = 8, ' Encode ', ' + ', ' encryption ' and ' = 30,
' Extract ', ' Filters ' and ' 42 ';
Echo Getcloud ($arr, 12, 36);
Here is an excerpt from the article published before this site. More tips can be used for reference.
21 useful and convenient PHP function codes collected
The above describes the tag cloud PHP create tag cloud function code, including the content of the tag cloud, I hope to be interested in PHP tutorial friends helpful.