title: PHP - Remove duplicates with foreach?
body: <p>I have a array of page numbers:</p>
  
  <pre><code>foreach($elements as $el) {
  $pageno = $el-&gt;getAttribute("pageno");
  
  echo  $pageno ;
  }
  </code></pre>
  
  <p>Sadly it contains duplicates. I tried the follow code but it won't return a thing:</p>
  
  <pre><code>foreach(array_unique($elements) as $el) {
  $pageno = $el-&gt;getAttribute("pageno");
  
  echo  $pageno ;
  }
  </code></pre>
  
  <p>How to remove the duplicate page numbers? Thanks in advance :) </p>