Re: Lines
| From: | Chris Anderson | Date: | Mon, 23 Apr 2001 03:57:40 +0000 |
| Subject: | Re: Lines | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-50158@lists.php.net to get a copy of this message | ||
$Data = file("data.dat");
$Total = count($data);
That would get the lines from the file and give $total the number of lines.
----- Original Message -----
From: "Rafael Faria" <rafaelrfc@bol.com.br>
To: <php-general@lists.php.net>
Sent: Tuesday, April 24, 2001 4:03 PM
Subject: Re: [PHP] Lines
> But how can i put into a var $total the total lines that i have into the
file?
>
> Rafael
>
> >f you use the file() function to open up the file, it will put each line
> >of the file into an array. At that point you can say:
> >
> >for($i=5;$i<11;$i++){
> >
> >print $myFile[$i];
> >
> >}
> >
> >
> >Michael
> >
> >
> >Rafael Faria wrote:
> >
> >>
> >>
> >>Hey Guys,
> >>it's my first post on this list, and my doubt is...
> >>
> >>how can i take a file.txt and
> >>
> >>1 - know how many lines i have in this text
> >>2 - print line 5 until 10
> >>
> >>?
> >>
> >>can someone help me?
> >>
> >>
> >>
> >>
> >>
> >>---
> >>
> >>[ r a f a e l f a r i a] _____________________
> >>_________________rafaelrfc@uol.com.br
> >>WebMaster Universo Online - http://www.uol.com.br
> >>Phone # +55 11 3038-8665
> >>
> >
> >
> >
>
> ---
>
> [ r a f a e l f a r i a] _____________________
> _________________rafaelrfc@uol.com.br
> WebMaster Universo Online - http://www.uol.com.br
> Phone # +55 11 3038-8665
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>