Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Line Count in CSV File 1

Status
Not open for further replies.

cmhunt

Programmer
Apr 17, 2001
119
GB
Is there a function to count the amount of lines in a CSV files without manually looping through the whole file and counting them?? I have looked on php.net and couldn't seem to find anything.

Thanks

Chris
 
You could read the file using the file() command.
That puts it into an array where each element is one line (with the line break still attached).
The do a count($myArray) to get the number of lines.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top