How to count the number of lines in a text file with PHP

1 Answer

0 votes
$file_name = "c:\\xampp\\php\\php.ini"; 

$number_of_lines = count(file($file_name)); 

echo "$number_of_lines lines in $file_name";


/*
run:

1989 lines in c:\xampp\php\php.ini 

*/

 



answered Feb 23, 2019 by avibootz

Related questions

1 answer 195 views
1 answer 195 views
1 answer 169 views
1 answer 196 views
1 answer 211 views
...