CoderZone.org

Category: >> PHP Code >> Count lines in file Bookmark and Share

<< lastnext >>

Snippet Name: Count lines in file

Description: Count the number of lines in a text file.

Also see:
» Simple directory viewer / browser
» Read a web page directly in to a s...
» Recursive Directory Browser
» Saving Remote Images With PHP
» Include All Files In A Directory
» More File Type Detection in PHP
» Get Current Page URL
» Get Current Directory Name
» Measure script run time
» Write to File example
» Check if a file exists
» Export table to Excel or MS Word f...
» Copy File From Server
» Remove All Files An A Given Direct...
» Calculate File/Folder Size In A Di...

Comment: (none)

Author: CoderZone
Language: PHP
Highlight Mode: PHP
Last Modified: March 16th, 2009

<?php  
 
$file = "somefile.txt";  
$lines = count(file($file));  
echo "There are $lines lines in $file";
 
?>
 
There haven't been any comments added for this snippet yet. You may add one if you like.  Add a comment 
© coderzone.org | users online: 27