title: Why isn't array_unique returning me a list of unique items?
body: <p>I am trying to scrape all the urls on the home page on my client's site so I can migrate it to wordpress. The problem is I can't seem to arrive at a de-duplicated list of urls.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>$html = file_get_contents('http://www.catwalkyourself.com');
  
  $dom = new DOMDocument();
  @$dom-&gt;loadHTML($html);
  
  // grab all the on the page
  $xpath = new DOMXPath($dom);
  $hrefs = $xpath-&gt;evaluate("/html/body//a");
  
  for ($i = 0; $i &lt; $hrefs-&gt;length; $i++) {
     $href = $hrefs-&gt;item($i);
     $url = $href-&gt;getAttribute('href');
  
     if($url = preg_match_all('((www|http://)(www)?.catwalkyourself.com\/?.*)', $url, $matches[0])){
      $urls = $matches[0][0][0];
      $list = implode( ', ', array_unique( explode(", ", $urls) ) );
      echo $list . '&lt;br/&gt;';
      //print_r($list);
     }
  }
  </code></pre>
  
  <p>(Also posted <a href="https://gist.github.com/2974247" rel="nofollow">here</a>.)</p>
  
  <p>Instead I am getting duplicates like this:</p>
  
  <pre><code>http://www.catwalkyourself.com/rss.php
  http://www.catwalkyourself.com/rss.php
  </code></pre>
  
  <p>How do I fix this?</p>