title: PHP tab delimited text file into array
body: <p>I have a huge text file structured like so:</p>
  
  <pre><code>email 1
  email 14
  email 1
  email 244
  email 232
  email 23
  email 1
  </code></pre>
  
  <p>I'm trying to pull the text file into an array, where I can then remove all emails that so not have a number one. Right now I'm limiting to the first 20, all of which have the number 1, but the only thing I'm getting in my array is the number 1. When I spit out the number of items in the line it says 1. </p>
  
  <pre><code>$file = "list.txt";// Your Temp Uploaded file
  $cols = array();
  ini_set('auto_detect_line_endings', true);
  
  $fh = fopen($file, 'r');
  $i = 0;
  
  while ($line = fgetcsv($fh, 1000, "\t") !== false) {
    $cols[] = $line;
  
    if($i == 19) { break; }
      $i++;
    }
  
  echo "&lt;pre&gt;";
  print_r($cols); 
  echo "&lt;/pre&gt;";
  
  Array
  (
  [0] =&gt; 1
  [1] =&gt; 1
  [2] =&gt; 1
  [3] =&gt; 1
  [4] =&gt; 1
  [5] =&gt; 1
  [6] =&gt; 1
  [7] =&gt; 1
  [8] =&gt; 1
  [9] =&gt; 1
  [10] =&gt; 1
  [11] =&gt; 1
  [12] =&gt; 1
  [13] =&gt; 1
  [14] =&gt; 1
  [15] =&gt; 1
  [16] =&gt; 1
  [17] =&gt; 1
  [18] =&gt; 1
  [19] =&gt; 1
  )
  </code></pre>
  
  <p>I've tried changing <code>\t</code> to <code>\n</code> but that didn't change the result. If I can do this all in one step that would be better, check the second item in the row and if it's a one then add the first item (email) into the array. Otherwise don't. At this point I'll take what I can get! Any ideas or suggestions?</p>
  
  <hr>
  
  <p>I now am getting the items in the array, but it's merging the columns into one array item:</p>
  
  <pre><code>Array
  (
  [0] =&gt; Array
      (
          [0] =&gt; EMAIL    1
      )
  )
  </code></pre>
  
  <p>Is there a way for me to spit out the columns into separate keys? So:</p>
  
  <pre><code>Array
  (
  [0] =&gt; Array
      (
          [0] =&gt; EMAIL
          [1] =&gt; 1
      )
  )
  </code></pre>