How do I read a file backwards line by line using fseek?
code can be helpful. must be cross platform and pure php.
many thanks in advance
regards
I know this has been answered already but I found another, maybe faster, way.
// Read last 5000 chars of 'foo.log' if(file_exists('foo.log') && $file = fopen('foo.log', 'r')) { fseek($file, -5000, SEEK_END); $text = stream_get_line($file, 5000); var_dump($text); fclose($file); }