phpnewbie112 Posted July 4, 2008 Share Posted July 4, 2008 Hello everyone! when I open a csv file with the fgetcsv() how can I echo the total numbers of lines. I used the count() but it is counting the total records per line while I need the total number of lines. thank you Link to comment https://forums.phpfreaks.com/topic/113197-solved-total-records-in-csv/ Share on other sites More sharing options...
phpnewbie112 Posted July 4, 2008 Author Share Posted July 4, 2008 I think I found it $fileName = "filename.txt"; $fp = fopen ($fileName, "r"); while(!feof($fp)) { $lines[] = fgets($fp, 4096); } $count = count($lines); echo $count; Link to comment https://forums.phpfreaks.com/topic/113197-solved-total-records-in-csv/#findComment-581610 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.