|
Posted by SquishedOrange on 02/08/07 20:51
Ur guys,
Have we read http://uk.php.net/manual/en/function.fseek.php ?
If you read the comments, there are some nice functions there
This one looks good:
<?php
function readLastLine ($file) {
$fp = @fopen($file, "r");
$pos = -1;
$t = " ";
while ($t != "\n") {
if (!fseek($fp, $pos, SEEK_END)) {
$t = fgetc($fp);
$pos = $pos - 1;
} else {
rewind($fp);
break;
}
}
$t = fgets($fp);
fclose($fp);
return $t;
}
?>
Navigation:
[Reply to this message]
|