title: PHP Array Unique
body: <p>I believe my issue is fairly basic and simple, but I think I am not getting through it.I have a PHP array which has been dynamically populated with data from the database</p>
  
  <pre><code>    $PInvoicesList=array();
      $SelectPInvoicesList ="SELECT * FROM AllDataEntriesList 
                              WHERE BusinessID = '{$businessid}' 
                              AND DocumentType = 'purchaseinvoice' 
                              ORDER BY Time ASC;";
      $SelectPInvoicesList_query = mysqli_query($connection, $SelectPInvoicesList);
      if(!$SelectPInvoicesList_query){
          die ("Database query for searching Purchase Invoices failed.".mysqli_error($connection));
      }
      while ($SelectPInvoicesList_array = mysqli_fetch_assoc($SelectPInvoicesList_query)){
  
          $PInvoicesList[]=$SelectPInvoicesList_array["DocumentID"];
      }
      array_unique($PInvoicesList);
      print_r($PInvoicesList);
  </code></pre>
  
  <p>And this gives me an array </p>
  
  <pre><code>Array ( [0] =&gt; pk-000000003-purchaseinvoice-1 
          [1] =&gt; pk-000000003-purchaseinvoice-1 
        )
  </code></pre>
  
  <p>When I apply <code>array_unique($PInvoicesList, SORT_STRING);</code>, I get both of both elements in the array, whereas they both have the same data. I used this function as <code>array_unique($PInvoicesList, SORT_REGULAR);</code> but still both the elements in the array are appearing and they have the exact same data. Can anyone guide me how can I remove the elements with duplicate values from this array?</p>