Basically you'll have to read the entire file and then look at the last line.
Because there's no way in general of knowing where in the file the line breaks are without actually looking for them, the whole file has to be looked at.
Laziest way to look at the first 12 characters of the last line would be
$file=file('filename.txt');
$lines=count($file);
echo substr($file[$lines-1],0,12);
or -2, depending on what the very end of the file looks like.
But more efficient techniques exist. One I just thought of now is to see how long the file is, read the last, say, 1024 bytes using the random-access file functions (assuming that no line is going to be longer than that, and in particular the last line is shorter than that), look for the last linebreak in that 1kB sample, and the last line is the stuff from there to the end of the file. Haven't coded that sort of thing yet.
And if you're on a Un*x box of some description, a system call to tail() (using the ` operator (aka. shell_exec()) could be used to do all the work for you.