title: fgetcsv / fopen in reverse
body: <p>I am trying to do this exact function, only want to be able to display the last 20 lines of the document?</p>
  
  <pre><code>    $file = fopen("/tmp/$importedFile.csv","r");
      while ($line =  fgetcsv($file))
      {
          $i++;
          $body_data['csv_preview'][] = $line;
          if ($i &gt; 20) break;
      }
      fclose($file);
  </code></pre>
  
  <p>I have tried changing the  <code>"r"</code> in <code>$file = fopen("/tmp/$importedFile.csv","r");</code>however it seems there is only variations of where to put the pointer with read and write.</p>
  
  <p>I feel this could be an easy one. my apologies.</p>