title: How do I get only unique values from CSV file array
body: <p>I am building a small application that does some simple reporting based on CSV files, the CSV files are in the following format:</p>
  
  <pre><code>DATE+TIME,CLIENTNAME1,HAS REQUEST BLABLA1,UNIQUE ID
  DATE+TIME,CLIENTNAME2,HAS REQUEST BLABLA2,UNIQUE ID
  DATE+TIME,CLIENTNAME1,HAS REQUEST BLABLA1,UNIQUE ID
  DATE+TIME,CLIENTNAME2,HAS REQUEST BLABLA2,UNIQUE ID
  </code></pre>
  
  <p>Now I am processing this using the following function:</p>
  
  <pre><code>function GetClientNames(){
      $file = "backend/AllAlarms.csv";
      $lines = file($file);
      arsort($lines);
  
      foreach ($lines as $line_num =&gt; $line) {
      $line_as_array = explode(",", $line);
          echo '&lt;li&gt;&lt;a href="#"&gt;&lt;i class="icon-pencil"&gt;&lt;/i&gt;' . $line_as_array[1] . '&lt;/a&gt;&lt;/li&gt;';
  
      }
  }
  </code></pre>
  
  <p>I am trying to retrieve only the Clientname values, but I only want the unique values.</p>
  
  <p>I have tried to create several different manners of approaching this, I understand I need to use the unique_array function, but I have no clue on exactly how to use this function.</p>
  
  <p>I've tried this:</p>
  
  <pre><code>function GetClientNames(){
      $file = "backend/AllAlarms.csv";
      $lines = file($file);
      arsort($lines);
  
      foreach ($lines as $line_num =&gt; $line) {
          $line_as_array = explode(",", $line);
          $line_as_array[1] = unique_array($line_as_array[1]);
          echo '&lt;li&gt;&lt;a href="#"&gt;&lt;i class="icon-pencil"&gt;&lt;/i&gt;' . $line_as_array[1] . '&lt;/a&gt;&lt;/li&gt;';
      }
  } 
  </code></pre>
  
  <p>But this gives me a very very dirty result with 100's of spaces instead of the correct data.</p>