Need to remove duplicates values from array during foreach
<p>Hey All,<br>
Just wondering if you can help me out.<br>
I have a column with rows of tags. In each row i have each tag separated with a comma and space.</p>

<p>for example: BMW M5, Leather Seats, 24 Inch Wheels, etc.  </p>

<p>What i need to do is loop through the array, explode it, and then print the values to the page. So far I have been able to do it; however, it prints the duplicates.  </p>

<p>Here is the code i have so far:  </p>

<pre><code>&lt;?php   
$cleanTags = ($row_getTags['tags']);  
$cleanerTags = str_replace(', ',"-",$cleanerTags);  
$tagstr = ($cleanerTags);   
$tags = explode('-',$tagstr);  

foreach($tags as $tag)  
{   
echo "&lt;li&gt;&lt;a href=\"results.php?search=".str_replace("&amp;nbsp;",'%20',$tag)."\" title=\"Find more stuff tagged:&amp;nbsp;".$tag."\" class=\"tagLink\"&gt;".$tag."&lt;/a&gt;&lt;/li&gt;";
}
?&gt;   
</code></pre>

<p>How can I go about removing duplicates from the array? I've tried array_unique with no luck. Any help would be greatly appreciated and I thank you in advance for your help!!!</p>

<p>Cheers</p>
