title: Remove or Replace last row of a CSV file with PHP
body: <p>I am trying to update last line of a csv file, I get the last line with using this code:</p>
  
  <pre><code>$f = public_path('MYCSV.csv');
  $rows = file($f);
  $last_row = array_pop($rows);
  $data = str_getcsv($last_row);
  </code></pre>
  
  <p>I searched a lot but did not find any way to replace or at least to remove the last line of csv file, it will be great if do not use foreach loop as the file size is big...</p>