RE: [PHP] # of lines in a file

From: Date: Mon, 09 Dec 2002 17:05:32 +0000
Subject: RE: [PHP] # of lines in a file
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-127527@lists.php.net to get a copy of this message
> 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 file() will read the file into an array, one line per element, so... $line_to_read = 55; $file_array = file('file.txt'); echo $file_array[$line_to_read]; Remember that arrays are zero based. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/

« previous php.general (#127527) next »