I have a text file such as a log file, and I want to get the last 50 lines from that.
How can I do it, in PHP?
I guess you could also be using "tail" if you are on linux.
$handle = popen("tail -50l YOUR_FILE_HERE 2>&1", 'r');
while(!feof($handle)) {
$buffer = fgets($handle);
echo "$buffer<br/>\n";
ob_flush();
flush();
}
pclose($handle);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With