Stackoverflow Tarzı Aynı Etiketleri Sayarak Yazdırmak

Öncelikle tags isimli bir veritabanınızın olması ve içinde name adlı sütun bulunması gereklidir.

.tag a{
    color: #3e6d8e;
    background-color: #e0eaf1;
    border-bottom: 1px solid #b3cee1;
    border-right: 1px solid #b3cee1;
    padding: 3px 4px 3px 4px;
    margin: 2px 2px 2px 0;
    text-decoration: none;
    font-size: 90%;
    line-height: 1.4;
    white-space: nowrap;
    display: inline-block;
}
<?php  header('Content-Type: text/html; charset=utf-8');
$dbhost     =   "localhost";    
$dbkullanici=   "root";     
$dbsifre    =   "";     
$dbname     =   "test";
$baglan = mysql_connect($dbhost, $dbkullanici, $dbsifre);  
mysql_select_db($dbname, $baglan);
mysql_query("SET NAMES 'utf8'"); 
$result = mysql_query("select name from tags");
$tags = array();
while ($row = mysql_fetch_array($result)) {
$kodlar = "•,-, ,|,>,<,(,),/,≈,",',\,/,[,],{,},*,1,2,3,4,5,6,7,8,9,0,’,“,”,.,:,;,#,$,!,+,%,&,=,?,_,~,¨,´,`,^";
$kodlar=array_filter(explode(",", $kodlar));
$bosalt   =",";
$row[0] = str_replace($kodlar, $bosalt, $row[0]);
        $row_tag_array = @split(",", $row[0]);
        foreach ($row_tag_array as $newtag) {
        asort($row_tag_array);
                if (array_key_exists($newtag, $tags)) {
                        if ($tags[$newtag] < 200) {
                                $tags[$newtag] = $tags[$newtag] + 1;
                        }
                }
                else {
                        $tags[$newtag] = 1;
                }
        }
}
foreach ($tags as $tag => $size) {
    echo '<div class="tag"><a href="http://localhost/search/'.$tag.'.html">'.$tag.'</a><span> x '.$size.'</span>';
}
?>

 

Sizin Değerli Görüşlerinize İhtiyacımız Var.