Jump to content

How to tell if its the last while loop??


Scooby08

Recommended Posts

If you ONLY need to read/process the last line, there's no need to loop through all of the lines first:

 

//Read file as an array
$lines = file('path/to/file/filename.txt');
//Assign the last line, as an array split by CSV, to a variable
$last_line = str_getcsv(array_pop($lines), ',');

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.