note 54199 added to function.fseek
| From: | chenganeyou at eyou dot com | Date: | Mon, 27 Jun 2005 08:35:17 +0000 |
| Subject: | note 54199 added to function.fseek | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-91000@lists.php.net to get a copy of this message | ||
I use the following codes to read the last line of a file.
Compared to jim at lfchosting dot com, it should be more efficient.
<?php
function readlastline($file)
{
$linecontent = " ";
$contents = file($file);
$linenumber = sizeof($file)-1;
$linecontet = $contents[$linenumber];
unset($contents,$linenumber);
return $linecontent;
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.fseek.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+54199
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54199&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54199&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54199&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54199&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54199&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54199&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+54199&report=yes
Search -- http://master.php.net/manage/user-notes.php