Tag Archives: Tail

PHP: Tail tackling large files

Needed a function that could get me the last N lines of a log file. Wanted it to be efficient and not dependent on anything other than my code.

Found some versions, but they were either a bit messy or depended on unstable arithmetic (where filesize is greater than PHP_INT_MAX). So, I decided to take on the challenge and try to write one myself. Nice little exercise 🙂

Continue reading PHP: Tail tackling large files