Calculate the size of your PHP program _ PHP Tutorial

Source: Internet
Author: User
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...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.