I have been battling on how to display distinct tag that I stored in database. In my database I have saved some tags, when I tried displaying it back I used array unique but it didn't work. see below example database
item | tag
---------|---------------
code 1 | html,php,css
code 2 | jquery,xml,js
code 3 | php,python,xhtml
code 4 | css
Now when i select tag from my table i will get below
<?php
$tags = 'html,php,css
jquery,xml,js
php,python,xhtml
css';
//Here i
$string = explode(',', $tags);
foreach($string as $linetag){
//echo $linetag;
$result = array_unique($linetag);
echo $resul;
}
?>
But the above code is not working. I want to display unique tags and remove duplicates like below
html,
php,
css
jquery,
xml,
js
python,
xhtml