Calculate the size of the PHP program you develop_PHP Tutorial

WBOY
Release: 2016-07-21 15:58:43
Original
956 people have browsed it

Copy code The code is as follows:

/**
* Calculate the size of the program in the directory, including the number of files, lines, and words.
* author Ryan
* @copyright Copyright (c) 2002-2004 by Shiner Technologies Co., Ltd.
* @package AAPortal
*/

// Please modify the location of this directory
$dir = "aaportal";


// No need to change the following
$counts = array("directory" => 0, "file" => 0, "line" => 0, "size" => 0);

check($dir);

echo "Total:n " ;
echo "Directry : ".$counts["directory"]."n";
echo "File : ".$counts["file"]."n";
echo "Line : ".$counts["line"]."n";
echo "Size : ".$counts["size"]."n";

function check($dir)
{
global $counts;

if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if ($file == ".") continue;
if ($file == "..") continue;
if ($file == "CVS") continue;
$path = $ dir."/".$file;
if (is_dir($path)) {
$counts["directory"]++;
                                            directory " ]." $pathn";
check($path);
} else {
$ext = array_pop(explode('.', basename($path)));
if ( $ ext=="php" || $ext=="inc") {
$counts["file"]++;
$counts["file"]++; //echo "file ".$counts["file"]." $ pathn";
$lines = file($path);
$counts["line"] += count($lines);
$count s["size"] += filesize($path ) ;                                    

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/317490.htmlTechArticleCopy the code as follows: ?php /** *Calculate the size of the program in this directory, including the number of files, lines Number, word count* *@version1.0 *@since1.0 *@accesspublic *@authorRyanryan@shinersoft.com...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!