Re: Reading line from a text file.
| From: | Martin | Date: | Mon, 23 Oct 2000 10:24:57 +0000 |
| Subject: | Re: Reading line from a text file. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-21763@lists.php.net to get a copy of this message | ||
$fp = fopen($filename, "r");
$line = 0;
while (!feof ($fp) && $line < 3)
{ $buffer = fgets($fp, 4096);
$line = $line + 1;
}
fclose($fp);
$buffer will contain line 3, if the file has 3 lines.
Greetings (aus Darmstadt)
Martin
"Boris.C" wrote:
>
> Hi,
>
> I've trouble reading special lines from a text file.
>
> For example I want to read out only line 3 from a file, how can I do?
>
> --
> 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