Calculate the size of your PHP program. Copy the code as follows :? Php *** calculates the program model under the project, including the case number, row number, word number ** @ version1.0 * @ since1.0 * @ accesspublic * @ authorRyanryan@shinersoft.com
The code is as follows:
/**
* Calculate the program specification under the project, including the number of cases, rows, and words.
*
* @ Version 1.0
* @ Since 1.0
* @ Access public
* @ Author Ryan
* @ Copyright Copyright (c) 2002-2004 by Shiner Technologies Co., Ltd.
* @ Package AAPortal
*/
// Modify the location of this object
$ Dir = "aaportal ";
// Do not make any changes below
$ 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"] ++;
// Echo "dir". $ counts ["directory"]. "$ path \ n ";
Check ($ path );
} Else {
$ Ext = array_pop (explode ('.', basename ($ path )));
If ($ ext = "php" | $ ext = "inc "){
$ Counts ["file"] ++;
// Echo "file". $ counts ["file"]. "$ path \ n ";
$ Lines = file ($ path );
$ Counts ["line"] + = count ($ lines );
$ Counts ["size"] + = filesize ($ path );
}
}
}
Closedir ($ dh );
}
}?>
The http://www.bkjia.com/PHPjc/317490.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/317490.htmlTechArticle code is as follows :? Php/*** calculates the program model under the project, including the number of cases, row number, number of words ** @ version1.0 * @ since1.0 * @ accesspublic * @ authorRyanryan@shinersoft.com...