note 21274 added to function.readdir

From: Date: Mon, 06 May 2002 07:00:49 +0000
Subject: note 21274 added to function.readdir
Groups: php.notes 
Request: Send a blank email to php-notes+get-30251@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"); ?> -- http://www.php.net/manual/en/function.readdir.php http://master.php.net/manage/user-notes.php?action=edit+21274 http://master.php.net/manage/user-notes.php?action=delete+21274 http://master.php.net/manage/user-notes.php?action=reject+21274

« previous php.notes (#30251) next »