note 21274 deleted from function.readdir by philip
| From: | philip@php.net | Date: | Fri, 08 Nov 2002 01:54:42 +0000 |
| Subject: | note 21274 deleted from function.readdir by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-39116@lists.php.net to get a copy of this message | ||
Here is a bit of code based on the second example that counts the number of lines of code for every
PHP page on your site (in that directory).
<?php
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if (substr($file, -3) == "php") {
$rawfile = file($file);
$linecnt = $linecnt + count($rawfile);
}
}
closedir($handle);
}
echo("Your site contains $linecnt lines of code");
?>