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
PHP's file() function reads the whole file into an array. This solution requires the least amount of typing:
$data = array_slice(file('file.txt'), -5); foreach ($data as $line) { echo $line; }