Can I read a file in PHP from my end, for example if I want to read last 10-20 lines?
And, as I read, if the size of the file is more than 10mbs I start getting erro
You can use fopen and fseek to navigate in file backwards from end. For example
$fp = @fopen($file, "r"); $pos = -2; while (fgetc($fp) != "\n") { fseek($fp, $pos, SEEK_END); $pos = $pos - 1; } $lastline = fgets($fp);