Hi and thanks for the reply.
Yes, using fopen like that would work, but I liked reading the file into an
array because I didn't have to open the file - no flock() to deal with, more
efficient, etc...
"David Precious" <pinkmeat@preshweb.co.uk> wrote in message
news:1079833150.73255.0@despina.uk.clara.net...[color=blue]
> deko wrote:
>[color=green]
> > $visits= file("visdata.txt");[/color]
> <snip>[color=green]
> > There must be a way to limit how many lines from the file are read into
> > the array -- any suggestions?
> >
> > Thanks in advance.[/color]
>
> Instead of the visits = file("visdata.txt"); line, try something like:
>
> $fh = @fopen('visdata.txt','r');
> if ($fh)
> {
> for ($i=0;$i<10;$i++)
> {
> $visits[] = fread($fh,4096);
> }
> } else {
> // handle error opening file here
> }
> // $visits is an array containing the first 10 lines of the file.
>
>
> That ought to do the trick.
>
> Cheers
>
> Dave P
>
>
> --
> David Precious
>
http://www.preshweb.co.uk/
>[/color]