title: Convert data to array, and find count based on filters
body: <p>I have data stored in a text file (This is a requirement), which I’ve turned into an array… 
  Now I’m trying filter my results based on 2 variables $Start_Date &amp; $End_Date
  …then display only unique values with the count next to it.</p>
  
  <p>Stats.txt</p>
  
  <pre><code>08/02/14 | Red | Wood
  08/03/14 | Red | Steel
  08/04/14 | Blue | Wood
  08/05/14 | Red | Steel
  08/05/14 | Red | Wood
  08/05/14 | Red | Steel
  08/05/14 | Blue | Steel
  08/06/14 | Blue | Wood
  </code></pre>
  
  <p>What I have so far:</p>
  
  <pre><code>  $logfile = "stats.txt";
    $Start_Date = 08/04/14;
    $End_Date = 08/05/14;
  
    if (file_exists($logfile)) {
  
          $handle = fopen($logfile, "r");
          $log = fread($handle, filesize($logfile));
          fclose($handle);
  
    } else {
          die ("The log file doesn't exist!");
    }
  
    // Seperate each logline
  
    $log = explode("\n", trim($log));
  
    // Seperate each part in each logline
    for ($i = 0; $i &lt; count($log); $i++) {
          $log[$i] = trim($log[$i]);
          $log[$i] = explode('|', $log[$i]);
    }
  </code></pre>
  
  <p>Desired Result: (based on $Start_Date = 08/04/14 and $End_Date = 08/05/14)</p>
  
  <pre><code>&lt;h2&gt;Date Count:&lt;/h2&gt;
  08/04/14 - 1
  08/05/14 - 4
  
  &lt;h2&gt;Color Count:&lt;/h2&gt;
  Red - 3
  Blue - 2
  
  &lt;h2&gt;Material Count:&lt;/h2&gt;
  Wood - 2
  Steel - 3
  </code></pre>