Read last line from file
This should work: $line=””; $f = fopen(‘data.txt’, ‘r’); $cursor = -1; fseek($f, $cursor, SEEK_END); $char = fgetc($f); /** * Trim trailing newline chars of the file */ while ($char === “\n” || $char === “\r”) { fseek($f, $cursor–, SEEK_END); $char = fgetc($f); } /** * Read until the start of file or first newline char … Read more