function tag_cloud ($tags, $min_size, $max_size, $link, $link_class
{
$min = minarray_values$tags));
$max = maxarray_values$tags));
$spread = $max - $min
$cloud = ''
if ($link_class != '') $link_class = "class="$link_class" "
if ($spread == 0) $spread = 1;
foreach$tags as $tag => $count) {
$size = $min_size + ($count - $min) * ($max_size - $min_size) / $spread
$cloud .= '<a style="font-size:'floor$size).'px" '$link_class
.'href="'$linkurlencode$tag).'">'$tag"</a>n"
}
return $cloud
}