I have a file named file.txt which is update by adding lines to it.
file.txt
I am reading it by this code:
$fp = fopen(\"file.txt\", \"r\"); $da
You can use my small helper library (2 functions)
https://github.com/jasir/file-helpers
Then just use:
//read last 5 lines $lines = \jasir\FileHelpers\FileHelpers::readLastLines($pathToFile, 5);