Depende de cómo interpreta "puede".
Si se pregunta si puede hacerlo directamente (con la función de PHP) sin leer todas las líneas anteriores, entonces la respuesta es: No, no puede.
Un final de línea es una interpretación de los datos y usted solo puede saber dónde están, si realmente lee los datos.
Si es un archivo realmente grande, no lo haría. Sería mejor si escanearas el archivo comenzando desde el final y leyeras bloques desde el final hasta el archivo.
actualización
Aquí hay una PHP sólo manera de leer los últimos n líneas de un archivo sin necesidad de leer a través de toda ella;
function last_lines($path, $line_count, $block_size = 512){
$lines = array();
// we will always have a fragment of a non-complete line
// keep this in here till we have our next entire line.
$leftover = "";
$fh = fopen($path, 'r');
// go to the end of the file
fseek($fh, 0, SEEK_END);
do{
// need to know whether we can actually go back
// $block_size bytes
$can_read = $block_size;
if(ftell($fh) < $block_size){
$can_read = ftell($fh);
}
// go back as many bytes as we can
// read them to $data and then move the file pointer
// back to where we were.
fseek($fh, -$can_read, SEEK_CUR);
$data = fread($fh, $can_read);
$data .= $leftover;
fseek($fh, -$can_read, SEEK_CUR);
// split lines by \n. Then reverse them,
// now the last line is most likely not a complete
// line which is why we do not directly add it, but
// append it to the data read the next time.
$split_data = array_reverse(explode("\n", $data));
$new_lines = array_slice($split_data, 0, -1);
$lines = array_merge($lines, $new_lines);
$leftover = $split_data[count($split_data) - 1];
}
while(count($lines) < $line_count && ftell($fh) != 0);
if(ftell($fh) == 0){
$lines[] = $leftover;
}
fclose($fh);
// Usually, we will read too many lines, correct that here.
return array_slice($lines, 0, $line_count);
}
Duplicado posible de: [PHP - leyendo desde el final de un archivo de texto] (http: // stackoverflow.com/questions/5697717) – hippietrail