Re: # of lines in a file
| From: | Adam Voigt | Date: | Mon, 09 Dec 2002 17:05:23 +0000 |
| Subject: | Re: # of lines in a file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-127526@lists.php.net to get a copy of this message | ||
$f = fopen("filename","r");
$data = fread($f,filesize("filename"));
fclose($f);
$data = explode("\n",$data);
$lines = count($data);
$certainline = $data[linenumberyouwant];
Replace filename in both places, and linenumberyouwant.
On Mon, 2002-12-09 at 11:58, Clivus2k1@aol.com wrote:
Hey guys, I've been searching the manual for a way to grab the
number of
lines in a file and read a particular line from it, however I found
no
solution to my problem so I'm wondering if any of you out there
could help me
:-)
- CS
--
Adam Voigt (adam@cryptocomm.com)
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc
Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc
Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc