Re: Tailing Files
| From: | Miguel Cruz | Date: | Sun, 05 May 2002 07:05:57 +0000 |
| Subject: | Re: Tailing Files | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-96120@lists.php.net to get a copy of this message | ||
On Sat, 4 May 2002, Liam MacKenzie wrote:
> just a simple question, how would I go about displaying the last 100 lines
> of a log file?
> I know that on the command line it's:
> tail -n 100 access_log
>
> Is there a PHP function to do this?
Not that I know of, but the process is pretty simple. Seek to the end of
the file, then read chunks backwards, spitting out a line each time you
see a line break.
miguel