11-06-2009, 06:50 AM
Credits and Source: http://www.dreamincode.net/
Name: Counting lines
Description: This code will count lines in each file in folder
Snippet:
Instructions: This will count lines in every .php or .css file in folder. If you need another files, in example .html, .xml or whatever add ' || $name[1] == "your filetype here" ' in 2nd IF statement
Thankyou for reading
Name: Counting lines
Description: This code will count lines in each file in folder
Snippet:
PHP Code:
if ($handle = opendir('.'))
{
while (false !== ($filename = readdir($handle)))
{
$name = explode(".", $filename);
if ($filename != "." && $filename != ".." && ($name[1] == "php" || $name[1] == "css"))
{
$file = file($filename);
$counts += count($file);
}
}
closedir($handle);
}
echo $counts;
Instructions: This will count lines in every .php or .css file in folder. If you need another files, in example .html, .xml or whatever add ' || $name[1] == "your filetype here" ' in 2nd IF statement
Thankyou for reading