0) { $t = " "; while ($t != "\n") { if(fseek($handle, $pos, SEEK_END) == -1) { $beginning = true; break; } $t = fgetc($handle); $pos --; } $linecounter --; if ($beginning) { rewind($handle); } $text[$lines-$linecounter-1] = fgets($handle); if ($beginning) break; } fclose ($handle); return array_reverse($text); } $fsize = round(filesize(TEXT_FILE)/1024/1024,2); #echo "".TEXT_FILE."\n\n"; #echo "File size is {$fsize} megabytes\n\n"; #echo "Last ".LINES_COUNT." lines of the file:\n\n"; echo "
\n\n";
 
$lines = read_file(TEXT_FILE, LINES_COUNT);
foreach ($lines as $line) {
   echo $line;
   }
echo "
\n\n"; ?>