How to exclude duplicate content from this piece of code?
<p>hope someone can help me out with this piece of code:</p>

<pre><code>&lt;?php

$righe_msg = file("dati.txt");
$num = 5;
$selected = array();     
while (count($selected)!=$num)
{
   $rand = rand(0,count($righe_msg)-1);
   $selected[$rand] = $righe_msg[];
}
$numero=0;  
foreach ($selected as $sel)
{
   $dato = explode("|", trim($sel));

    if (trim($dato[5])=="yes")
    {
        $numero++;
        echo"&lt;tr&gt;&lt;td bgcolor='#EEEEEE'&gt;&amp;raquo; &lt;a href='$dato[2]'&gt; $dato[1]&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt; ";
    }
}

?&gt;
</code></pre>

<p>It's working ok, but sometimes it's pulling out duplicate content.</p>
