title: fgetcsv skip blank lines in file
body: <p>I have this script that I did, it basically grabs all the files in my "logs" folder and merge them all in one array file, my only problem is that, sometimes the script breaks if there is blank line or empty line! how can I tell it to automatically skip blank empty lines and go to next? blank lines are not necessarily at the top or bottom! could be in the middle of the csv file</p>
  
  <pre><code>&lt;?php
      $csv = array();
      $files = glob('../logs/*.*');
      $out = fopen("newfile.txt", "w");
  
      foreach($files as $file){
          $in = fopen($file, "r");
  
      while (($result = fgetcsv($in)) !== false)
  
          {   
              $csv[] = $result;
          }
  
          fclose($in);
          fclose($out);
      }
  
      print json_encode(array('aaData' =&gt; $csv ));
  ?&gt;
  </code></pre>