Re: Finding number of lines in a file
| From: | Dragos Roua | Date: | Mon, 04 Sep 2000 07:09:40 +0000 |
| Subject: | Re: Finding number of lines in a file | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-15066@lists.php.net to get a copy of this message | ||
> Hi
>
> What is the method for finding number of lines in a text file. I tried
> to use filesize, but it seems not working properly.
>
> Help me
>
> regards
> Vivek K
>
Try something like:
<?
$file = file($file_name);
$lines = count($file);
?>
file() - reads the entire content of a file into an array of lines. Check out
the files function on the php.net manual.
--
Dragos Roua
Mirabilis Media,
http://www.portal.ro http://www.net-info.ro
http://www.analyser.ro http://www.adserver.ro
http://www.culinar.ro http://www.cartipostale.ro