Question

From Users
Details

Hello sorry for my bad English.

I want to make a tag cloud and i don't know how to get words by words from string .

here is example what I want to make

Code
$text = "admin,demo"; //whit foreach in php

to


<a href="/admin" title="admin">admin</a><a href="/demo" title="demo">demo</a>


please help me :(

one more question how i get only unique array from more rows :


<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');

include_once ('/var/www/video/configs/db.php'); 

$query = @mysql_query("SELECT * FROM videos ORDER BY VIDEOID ASC LIMIT 0,10");
while($row = @mysql_fetch_array($query)){ $tags = $row['tags']; }

$rand = rand(5, 55);
$list  = explode(',', $tags);
foreach ($list as $link) { 
$tags = array( array('tag' => "$link", 'num' =>  $rand, 'link' => "$link"), ); 

$array = array_unique($tags); print_r($array);

}
?>

Answers

    A= 1
    Answer

    Try this wink

    Code
    
    
    $text = 'admin,demo';
    $list = explode(',', $text);
    
    foreach ($list as $link) {
        echo '<a href="/'.$link.'" title="'.$link.'">'.$link.'</a>';
    }
    
    

Give  Answer

Login for give Answer