I have a file named file.txt
which is update by adding lines to it.
I am reading it by this code:
$fp = fopen(\"file.txt\", \"r\");
$da
I've tested this one. It works for me.
function getlast($filename,$linenum_to_read,$linelength){
// this function takes 3 arguments;
if (!$linelength){ $linelength = 600;}
$f = fopen($filename, 'r');
$linenum = filesize($filename)/$linelength;
for ($i=1; $i<=($linenum-$linenum_to_read);$i++) {
$data = fread($f,$linelength);
}
echo "";
for ($j=1; $j<=$linenum_to_read+1;$j++) {
echo fread($f,$linelength);
}
echo "
The filesize is:".filesize("$filename");
}
getlast("file.txt",6,230);
?>